index.dart 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import 'package:farmer_client/models/entities/Address.dart';
  2. import 'package:get/get.dart';
  3. import 'package:get_storage/get_storage.dart';
  4. import './widgets/OtherColumn.dart';
  5. import './widgets/UserAddress.dart';
  6. import './widgets/UserInfo.dart';
  7. import 'package:flutter/material.dart';
  8. import 'package:flutter_screenutil/flutter_screenutil.dart';
  9. class MainPage extends StatelessWidget {
  10. final Address item;
  11. MainPage({Key? key, required this.item}) : super(key: key);
  12. GetStorage box = GetStorage();
  13. @override
  14. Widget build(BuildContext context) {
  15. print('644444444444444+$item');
  16. return Container(
  17. alignment: Alignment.center,
  18. child: Column(
  19. children: [
  20. Column(
  21. children: [
  22. UserInfo(), //头部,头像手机号姓名
  23. UserAddress(item:item),//用户地址
  24. OtherColumn(), //功能菜单栏
  25. Container(
  26. height: 70.h,
  27. margin: EdgeInsets.only(top: 0, bottom: 40.0),
  28. alignment: Alignment.bottomCenter,
  29. decoration: BoxDecoration(
  30. boxShadow: [
  31. BoxShadow(
  32. blurRadius: 10, //阴影范围
  33. spreadRadius: 0.1, //阴影浓度
  34. color: Colors.grey.withOpacity(0.2), //阴影颜色
  35. ),
  36. ],
  37. ),
  38. child: SizedBox(
  39. width: 315.w,
  40. height: 49.h,
  41. child: ElevatedButton(
  42. onPressed: () {
  43. showDialog(
  44. context: context,
  45. builder: (context) {
  46. return AlertDialog(
  47. content: Text("您确定退出登录吗?"),
  48. actions: <Widget>[
  49. TextButton(
  50. child: Text("取消"),
  51. onPressed: () {
  52. Navigator.pop(context, 'Cancle');
  53. },
  54. ),
  55. TextButton(
  56. child: Text("确定"),
  57. onPressed: () {
  58. Navigator.pop(context, "Ok");
  59. box.remove('token');
  60. Get.offNamed('/login');
  61. })
  62. ]);
  63. });
  64. },
  65. child: const Text(
  66. "退出登陆",
  67. style: TextStyle(
  68. fontSize: 18,
  69. color: Colors.black,
  70. fontWeight: FontWeight.bold),
  71. ),
  72. style: ButtonStyle(
  73. elevation: MaterialStateProperty.all(0),
  74. backgroundColor:
  75. MaterialStateProperty.all(const Color(0xFFFFFFFF)),
  76. shape: MaterialStateProperty.all(
  77. const RoundedRectangleBorder(
  78. borderRadius:
  79. BorderRadius.all(Radius.circular(24.4)))),
  80. ),
  81. ),
  82. ),
  83. ),
  84. ],
  85. ),
  86. ],
  87. ),
  88. );
  89. }
  90. }