update getx to function

hmxc
小赖 4 years ago
parent bd8a2afa07
commit 7958be966e

@ -3,5 +3,5 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
extension PageExt on Widget {
Function get to => () => Get.to(this);
Function get to => () => Get.to(() => this);
}

@ -114,18 +114,16 @@ class AddressItem extends StatelessWidget {
top: 55.w,
child: InkWell(
onTap: () {
Get.to(
AddressEditPage(
bundle: Bundle()
..putMap('details', {
'title': '编辑地址',
'name': name,
'phone': phone,
'address': address,
'isDelete': true
}),
),
);
AddressEditPage(
bundle: Bundle()
..putMap('details', {
'title': '编辑地址',
'name': name,
'phone': phone,
'address': address,
'isDelete': true
}),
).to();
},
child: Row(
children: [

@ -190,10 +190,10 @@ class ConfirmContent extends StatelessWidget {
),
InkWell(
onTap: () {
Get.to(InvoicePage(
bundle: Bundle()
..putString('title', '1123123123123'),
));
Get.to(() => InvoicePage(
bundle: Bundle()
..putString('title', '1123123123123'),
));
},
child: Row(
children: [

@ -39,7 +39,7 @@ class _HomeSearchState extends State<HomeSearch> {
minWidth: double.infinity,
color: Color(0xFFF3F3F3),
onPressed: () {
Get.to(BeeSearch());
Get.to(() => BeeSearch());
},
child: Row(
children: [

@ -55,7 +55,7 @@ class _AlarmPageState extends State<AlarmPage> {
title: '一键报警',
actions: [
MaterialButton(
onPressed: () => Get.to(AlarmDetailPage()),
onPressed: () => Get.to(() => AlarmDetailPage()),
child: '功能说明'.text.black.size(28.sp).make(),
)
],

@ -98,7 +98,7 @@ class _SignInPageState extends State<SignInPage> {
} else {
cancel();
signUpProvider.setTel(_phone.text);
await Get.to(SignUpPickPlotPage());
await Get.to(() => SignUpPickPlotPage());
signUpProvider.clearAll();
}
} else {

@ -55,7 +55,7 @@ class _SignUpPickRolePageState extends State<SignUpPickRolePage> {
shape: StadiumBorder(),
disabledColor: kPrimaryColor.withOpacity(0.3),
child: '提交'.text.make(),
onPressed: () => Get.to(SignUpSetNicknamePage()),
onPressed: () => Get.to(() => SignUpSetNicknamePage()),
elevation: 0,
).pLTRB(82.w, 0, 82.w, 155.w),
);

@ -73,7 +73,7 @@ class _SignUpSetNicknamePageState extends State<SignUpSetNicknamePage> {
final signUpProvider =
Provider.of<SignUpProvider>(context, listen: false);
signUpProvider.setNickName(_textEditingController.text);
Get.to(SignUpVerifyPage());
Get.to(() => SignUpVerifyPage());
}
},
),

@ -260,7 +260,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Get.dialog(_showDeletDialog());
}
: () async {
bool needRefresh = await Get.to(AddFixedSubmitPage());
bool needRefresh = await Get.to(() => AddFixedSubmitPage());
if (needRefresh == null) _easyRefreshController.callRefresh();
},
child: _isEdit

@ -161,7 +161,7 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
MaterialButton(
height: 92.w,
onPressed: () =>
Get.to(ActivityPeopleListPage(id: widget.id)),
Get.to(() => ActivityPeopleListPage(id: widget.id)),
child: Row(
children: [
StackAvatar(

@ -70,7 +70,7 @@ class _CommunityPageState extends State<CommunityPage>
fab: FloatingActionButton(
onPressed: () async {
if (LoginUtil.isNotLogin) return;
bool result = await Get.to(AddNewEventPage());
bool result = await Get.to(() => AddNewEventPage());
if (result == true) {
switch (_tabController.index) {
case 0:

@ -29,7 +29,7 @@ class TopicCommunityViewState extends State<TopicCommunityView>
return MaterialButton(
padding: EdgeInsets.symmetric(horizontal: 53.w, vertical: 20.w),
onPressed: () {
Get.to(TopicDetailPage(model: model));
Get.to(() => TopicDetailPage(model: model));
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,

@ -40,7 +40,7 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
heroTag: 'event_add',
onPressed: () async {
if (LoginUtil.isNotLogin) return;
bool result = await Get.to(AddNewEventPage());
bool result = await Get.to(() => AddNewEventPage());
},
child: Icon(Icons.add),
),

@ -274,7 +274,7 @@ class _ChatCardState extends State<ChatCard> {
padding: EdgeInsets.zero,
onPressed: widget.canTap
? () {
Get.to(EventDetailPage(themeId: widget.model.id));
Get.to(() => EventDetailPage(themeId: widget.model.id));
}
: null,
child: Row(

@ -61,7 +61,7 @@ class MyEventCard extends StatelessWidget {
: SizedBox(),
MaterialButton(
onPressed: () {
Get.to(EventDetailPage(themeId: model.id));
Get.to(() => EventDetailPage(themeId: model.id));
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,

@ -69,7 +69,7 @@ class NoticeCard extends StatelessWidget {
: SizedBox(),
MaterialButton(
onPressed: () {
Get.to(NoticeDetailPage(id: model.id));
Get.to(() => NoticeDetailPage(id: model.id));
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,

@ -35,7 +35,7 @@ class _AllApplicationPageState extends State<AllApplicationPage> {
? null
: () {
if (LoginUtil.isNotLogin) return;
Get.to(object.page);
Get.to(() => object.page);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -239,7 +239,7 @@ class _AllApplicationPageState extends State<AllApplicationPage> {
minWidth: double.infinity,
color: Color(0xFFF3F3F3),
onPressed: () {
Get.to(BeeSearch());
Get.to(() => BeeSearch());
},
child: Row(
children: [

@ -60,7 +60,7 @@ class _HomeNotificationState extends State<HomeNotification> {
: GestureDetector(
onTap: () {
if (randomItem != null)
Get.to(NoticeDetailPage(id: randomItem.id));
Get.to(() => NoticeDetailPage(id: randomItem.id));
},
child: AnimatedSwitcher(
duration: Duration(milliseconds: 1000),

@ -184,7 +184,8 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
),
bottomNavi: BottomButton(
onPressed: () async {
bool result = await Get.to(AdviceAddCommentPage(id: widget.model.id));
bool result =
await Get.to(() => AdviceAddCommentPage(id: widget.model.id));
if (result && mounted) _refreshController.callRefresh();
},
child: '继续提问'.text.bold.make(),

@ -40,7 +40,7 @@ class _BeeSearchState extends State<BeeSearch> {
return MaterialButton(
onPressed: () {
if (LoginUtil.isNotLogin) return;
Get.to(e.page);
Get.to(() => e.page);
},
shape: StadiumBorder(),
child: Column(

@ -17,7 +17,7 @@ class LoginUtil {
final userProvider = Provider.of<UserProvider>(Get.context, listen: false);
if (userProvider.isNotLogin) {
BotToast.showText(text: '请先登录');
Get.to(SignInPage());
Get.to(() => SignInPage());
return false;
}
return true;

@ -80,7 +80,7 @@ class _GridImagePickerState extends State<GridImagePicker> {
),
child: MaterialButton(
onPressed: () {
Get.to(BeeImagePreview.file(file: file), opaque: false);
Get.to(() => BeeImagePreview.file(file: file), opaque: false);
},
onLongPress: () async {
bool result = await Get.dialog(CupertinoAlertDialog(

@ -35,7 +35,7 @@ class _ApplicationViewState extends State<ApplicationView> {
padding: EdgeInsets.zero,
onPressed: () {
if (LoginUtil.isNotLogin) return;
Get.to(object.page);
Get.to(() => object.page);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

Loading…
Cancel
Save