text
我想有这样的行为,当用户拉下来他得到一个文本拉添加更多和小部件在当前屏幕上拖动下来沿着它。
要在释放时下拉显示文本和导航。
body: Column(
children: [
Expanded(
flex: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Spent This Week',
style: kSmallDarkGreyTextStyle),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
textBaseline: TextBaseline.ideographic,
children: [
const Padding(
padding: EdgeInsets.all(3),
child: Text('₹', style: kBigDarkGreyTextStyle),
),
Text(
weekAverage.toStringAsFixed(2),
style: kBlackAmountTextStyle,
)
],
)
],
)),
Expanded(
flex: 5,
child: Column(
children: const [
Text(''),
],
),
),
],
),
我没有使用RefreshIndicator,因为它不允许我改变刷新图标,我想在它的地方文本。我寻找不同的方法来实现它结束了。
link
我试图使用它改变了所有列项目从展开的小部件使用具有特定高度的小部件
import 'package:expense_manager/constants.dart';
import 'package:flutter/material.dart';
import 'package:custom_refresh_indicator/custom_refresh_indicator.dart';
import 'package:responsive_sizer/responsive_sizer.dart';
import 'AddExpenditureScreen.dart';
class CurrentWeekScreen extends StatefulWidget {
static String id = 'current_week_screen';
@override
State<CurrentWeekScreen> createState() => _CurrentWeekScreenState();
}
class _CurrentWeekScreenState extends State<CurrentWeekScreen> {
late double weekAverage = 23454.99;
IndicatorController controller = IndicatorController();
onlyDecimal(double weekAverage) {}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: const Icon(
Icons.search,
color: Colors.black,
size: 28,
),
actions: [
IconButton(
onPressed: () {},
icon: const Icon(
Icons.add_circle_outlined,
color: Colors.black,
size: 28,
),
),
],
),
body: CustomRefreshIndicator(
builder: (BuildContext context, Widget child, IndicatorController controller) { return Text('Pull to refresh'); },
onRefresh: () async{
Navigator.pushNamed(context, AddExpenditureScreen.id);
},
child: ListView(
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
children: [
SizedBox(
height: 38.h,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Spent This Week', style: kSmallDarkGreyTextStyle),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
textBaseline: TextBaseline.ideographic,
children: [
const Padding(
padding: EdgeInsets.all(3),
child: Text('₹', style: kBigDarkGreyTextStyle),
),
Text(
weekAverage.toStringAsFixed(2),
style: kBlackAmountTextStyle,
)
],
)
],
),
),
SizedBox(
height: 60.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: const [
Text(''),
],
),
),
],
),
),
);
}
}
能够导航
1条答案
按热度按时间xam8gpfp1#
使用了custom_refresh_indicator,
Go through this article
需要注意的重要事项是AnimatedBuilder和Transform的功能
the results
在屏幕中,您希望调用指示器并指定onAction,并提供一个ListView作为子级
创建swipe_action.dart文件=〉