refactor settings page

hmxc
小赖 4 years ago
parent 765470c5cf
commit b7df47116f

@ -54,12 +54,16 @@ class _SettingsPageState extends State<SettingsPage> {
); );
} }
Widget _containerQuit() { Widget _quitButton() {
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
return InkWell( return userProvider.isLogin
onTap: () { ? MaterialButton(
userProvider.isSigned elevation: 0,
? showCupertinoModalPopup( color: Colors.white,
height: 96.w,
child: '退出当前账号'.text.color(ktextPrimary).size(32.sp).bold.make(),
onPressed: () {
showCupertinoModalPopup(
context: context, context: context,
builder: (context) { builder: (context) {
return CupertinoActionSheet( return CupertinoActionSheet(
@ -73,8 +77,8 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
), ),
onPressed: () { onPressed: () {
userProvider.setisSigned(false); userProvider.logout();
Get.back(); Get.offAll(SignInPage());
}, },
), ),
], ],
@ -86,47 +90,10 @@ class _SettingsPageState extends State<SettingsPage> {
), ),
); );
}, },
) );
: SignInPage().to(); },
}, )
child: userProvider.isSigned : SizedBox();
? Container(
color: Colors.white,
height: 96.w,
padding: EdgeInsets.only(
top: 26.w,
bottom: 25.w,
),
alignment: Alignment.center,
child: Text(
'退出当前帐号',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize32,
color: ktextPrimary,
),
),
)
: Container(
alignment: Alignment.center,
height: 89.w,
width: 586.w,
padding: EdgeInsets.only(top: 25.w, bottom: 24.w),
margin: EdgeInsets.symmetric(horizontal: 82.w),
decoration: BoxDecoration(
color: Color(0xffffc40c),
borderRadius: BorderRadius.all(Radius.circular(36)),
),
child: Text(
'登录',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize28,
color: ktextPrimary,
),
),
),
);
} }
@override @override
@ -210,8 +177,8 @@ class _SettingsPageState extends State<SettingsPage> {
thickness: 1.w, thickness: 1.w,
height: 1.w, height: 1.w,
)), )),
50.hb, 53.hb,
_containerQuit(), _quitButton(),
], ],
), ),
); );

Loading…
Cancel
Save