index.dart 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. import 'package:farmer_client/widgets/Modal.dart' as modal;
  10. class MainPage extends StatelessWidget {
  11. final Address item;
  12. MainPage({Key? key, required this.item}) : super(key: key);
  13. GetStorage box = GetStorage();
  14. void _userOut() {
  15. modal.showDialog(
  16. title: '提示',
  17. content: Container(
  18. alignment: Alignment.center,
  19. child: Text('确定要退出登陆吗?'),
  20. ),
  21. onCancel: () => true,
  22. onConfirm: () => {
  23. box.remove('token'),
  24. Get.offAllNamed('/login'),
  25. });
  26. }
  27. @override
  28. Widget build(BuildContext context) {
  29. return Container(
  30. alignment: Alignment.center,
  31. child: ListView(
  32. children: [
  33. Column(
  34. children: [
  35. UserInfo(), //头部,头像手机号姓名
  36. UserAddress(item: item), //用户地址
  37. OtherColumn(), //功能菜单栏
  38. Card(
  39. //设置圆角
  40. shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
  41. // 普通的边
  42. /* shape: Border.all(
  43. color: Colors.yellow,
  44. width: 5.0
  45. ),*/
  46. elevation: 1,// 阴影大小
  47. // height: 70.h,
  48. margin: EdgeInsets.only(top: 10, bottom: 40.0),
  49. // alignment: Alignment.bottomCenter,
  50. // decoration: BoxDecoration(
  51. // boxShadow: [
  52. // BoxShadow(
  53. // blurRadius: 10, //阴影范围
  54. // spreadRadius: 0.1, //阴影浓度
  55. // color: Colors.grey.withOpacity(0.2), //阴影颜色
  56. // ),
  57. // ],
  58. // ),
  59. child: SizedBox(
  60. width: 315.w,
  61. height: 49.h,
  62. child: ElevatedButton(
  63. onPressed: () {
  64. _userOut();
  65. },
  66. child: const Text(
  67. "退出登陆",
  68. style: TextStyle(
  69. fontSize: 18,
  70. color: Colors.black,
  71. fontWeight: FontWeight.bold),
  72. ),
  73. style: ButtonStyle(
  74. elevation: MaterialStateProperty.all(0),
  75. backgroundColor:
  76. MaterialStateProperty.all(const Color(0xFFFFFFFF)),
  77. shape: MaterialStateProperty.all(
  78. const RoundedRectangleBorder(
  79. borderRadius:
  80. BorderRadius.all(Radius.circular(24.4)))),
  81. ),
  82. ),
  83. ),
  84. ),
  85. Container(
  86. margin: EdgeInsets.fromLTRB(0, 5, 0, 15),
  87. child: Text('南京市云致科技有限公司 提供技术支持',style: TextStyle(fontSize: 15.sp,color: Color(
  88. 0xff999999)),),
  89. )
  90. ],
  91. ),
  92. ],
  93. ),
  94. );
  95. }
  96. }