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'; import 'package:get/get.dart';
extension PageExt on Widget { 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, top: 55.w,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Get.to( AddressEditPage(
AddressEditPage( bundle: Bundle()
bundle: Bundle() ..putMap('details', {
..putMap('details', { 'title': '编辑地址',
'title': '编辑地址', 'name': name,
'name': name, 'phone': phone,
'phone': phone, 'address': address,
'address': address, 'isDelete': true
'isDelete': true }),
}), ).to();
),
);
}, },
child: Row( child: Row(
children: [ children: [

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -184,7 +184,8 @@ class _AdviceDetailPageState extends State<AdviceDetailPage> {
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
onPressed: () async { 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(); if (result && mounted) _refreshController.callRefresh();
}, },
child: '继续提问'.text.bold.make(), child: '继续提问'.text.bold.make(),

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

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

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

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

Loading…
Cancel
Save