Showing
45 changed files
with
0 additions
and
1443 deletions
assets/images/shop/dark_dpsz.png
deleted
100644 → 0
2.6 KB
assets/images/shop/dark_txzh.png
deleted
100644 → 0
1.92 KB
assets/images/shop/dark_zhls.png
deleted
100644 → 0
1.04 KB
assets/images/shop/dark_zjgl.png
deleted
100644 → 0
1.43 KB
assets/images/shop/dpsz.png
deleted
100644 → 0
2.46 KB
assets/images/shop/message.png
deleted
100644 → 0
1.27 KB
assets/images/shop/setting.png
deleted
100644 → 0
1.61 KB
assets/images/shop/tj.png
deleted
100644 → 0
429 Bytes
assets/images/shop/tx.png
deleted
100644 → 0
12.3 KB
assets/images/shop/txzh.png
deleted
100644 → 0
1.77 KB
assets/images/shop/wxzyf.png
deleted
100644 → 0
833 Bytes
assets/images/shop/xz.png
deleted
100644 → 0
1014 Bytes
assets/images/shop/xztm.png
deleted
100644 → 0
912 Bytes
assets/images/shop/xzyf.png
deleted
100644 → 0
1014 Bytes
assets/images/shop/zhls.png
deleted
100644 → 0
1.17 KB
assets/images/shop/zjgl.png
deleted
100644 → 0
1.46 KB
assets/images/shop/zybq.png
deleted
100644 → 0
4.9 KB
14 KB
19.4 KB
9.81 KB
assets/images/store/2.0x/icon_zj.png
deleted
100644 → 0
1.69 KB
24.3 KB
33.5 KB
16.7 KB
assets/images/store/3.0x/icon_zj.png
deleted
100644 → 0
2.58 KB
assets/images/store/icon_failure.png
deleted
100644 → 0
5.78 KB
assets/images/store/icon_success.png
deleted
100644 → 0
7.04 KB
assets/images/store/icon_wait.png
deleted
100644 → 0
4 KB
assets/images/store/icon_zj.png
deleted
100644 → 0
884 Bytes
| ... | @@ -7,7 +7,6 @@ import 'package:one_poem/home/webview_page.dart'; | ... | @@ -7,7 +7,6 @@ import 'package:one_poem/home/webview_page.dart'; |
| 7 | import 'package:one_poem/login/login_router.dart'; | 7 | import 'package:one_poem/login/login_router.dart'; |
| 8 | import 'package:one_poem/poem/poem_router.dart'; | 8 | import 'package:one_poem/poem/poem_router.dart'; |
| 9 | import 'package:one_poem/setting/setting_router.dart'; | 9 | import 'package:one_poem/setting/setting_router.dart'; |
| 10 | -import 'package:one_poem/shop/shop_router.dart'; | ||
| 11 | 10 | ||
| 12 | import 'i_router.dart'; | 11 | import 'i_router.dart'; |
| 13 | import 'not_found_page.dart'; | 12 | import 'not_found_page.dart'; |
| ... | @@ -40,7 +39,6 @@ class Routes { | ... | @@ -40,7 +39,6 @@ class Routes { |
| 40 | 39 | ||
| 41 | _listRouter.clear(); | 40 | _listRouter.clear(); |
| 42 | /// 各自路由由各自模块管理,统一在此添加初始化 | 41 | /// 各自路由由各自模块管理,统一在此添加初始化 |
| 43 | - _listRouter.add(ShopRouter()); | ||
| 44 | _listRouter.add(LoginRouter()); | 42 | _listRouter.add(LoginRouter()); |
| 45 | _listRouter.add(TimelineRouter()); | 43 | _listRouter.add(TimelineRouter()); |
| 46 | _listRouter.add(PoemRouter()); | 44 | _listRouter.add(PoemRouter()); | ... | ... |
lib/shop/iview/shop_iview.dart
deleted
100644 → 0
| 1 | - | ||
| 2 | -class FreightConfigModel { | ||
| 3 | - | ||
| 4 | - FreightConfigModel(this.min, this.max, this.type, | ||
| 5 | - this.isAdd, this.price); | ||
| 6 | - | ||
| 7 | - FreightConfigModel.fromJsonMap(Map<String, dynamic> map): | ||
| 8 | - min = map['min'] as String, | ||
| 9 | - max = map['max'] as String, | ||
| 10 | - type = map['type'] as int, | ||
| 11 | - isAdd = map['isAdd'] as bool, | ||
| 12 | - price = map['price'] as String; | ||
| 13 | - | ||
| 14 | - String min; | ||
| 15 | - String max; | ||
| 16 | - int type; | ||
| 17 | - bool isAdd; | ||
| 18 | - String price; | ||
| 19 | - | ||
| 20 | - Map<String, dynamic> toJson() { | ||
| 21 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 22 | - data['min'] = min; | ||
| 23 | - data['max'] = max; | ||
| 24 | - data['type'] = type; | ||
| 25 | - data['isAdd'] = isAdd; | ||
| 26 | - data['price'] = price; | ||
| 27 | - return data; | ||
| 28 | - } | ||
| 29 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/res/resources.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/shop/models/freight_config_model.dart'; | ||
| 5 | -import 'package:one_poem/shop/widgets/price_input_dialog.dart'; | ||
| 6 | -import 'package:one_poem/shop/widgets/range_price_input_dialog.dart'; | ||
| 7 | -import 'package:one_poem/util/theme_utils.dart'; | ||
| 8 | -import 'package:one_poem/util/toast_utils.dart'; | ||
| 9 | -import 'package:one_poem/widgets/load_image.dart'; | ||
| 10 | -import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 11 | -import 'package:one_poem/widgets/my_button.dart'; | ||
| 12 | -import 'package:one_poem/widgets/my_card.dart'; | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -/// design/7店铺-店铺配置/index.html | ||
| 16 | -class FreightConfigPage extends StatefulWidget { | ||
| 17 | - | ||
| 18 | - const FreightConfigPage({Key? key}) : super(key: key); | ||
| 19 | - | ||
| 20 | - @override | ||
| 21 | - _FreightConfigPageState createState() => _FreightConfigPageState(); | ||
| 22 | -} | ||
| 23 | - | ||
| 24 | -class _FreightConfigPageState extends State<FreightConfigPage> { | ||
| 25 | - | ||
| 26 | - final List<FreightConfigModel> _list = []; | ||
| 27 | - | ||
| 28 | - @override | ||
| 29 | - void initState() { | ||
| 30 | - super.initState(); | ||
| 31 | - _reset(); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - void _reset() { | ||
| 35 | - _list.clear(); | ||
| 36 | - _list.add(FreightConfigModel('0', '', 1, false, '')); | ||
| 37 | - _list.add(FreightConfigModel('', '', 1, true, '')); | ||
| 38 | - _list.add(FreightConfigModel('', '-1', 1, false, '')); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @override | ||
| 42 | - Widget build(BuildContext context) { | ||
| 43 | - return Scaffold( | ||
| 44 | - resizeToAvoidBottomInset: false, | ||
| 45 | - appBar: MyAppBar( | ||
| 46 | - title: '运费比例配置', | ||
| 47 | - actionName: '重置', | ||
| 48 | - onPressed: () { | ||
| 49 | - setState(() { | ||
| 50 | - _reset(); | ||
| 51 | - }); | ||
| 52 | - }, | ||
| 53 | - ), | ||
| 54 | - body: SafeArea( | ||
| 55 | - child: Stack( | ||
| 56 | - children: <Widget>[ | ||
| 57 | - Positioned( | ||
| 58 | - left: 16.0, | ||
| 59 | - right: 16.0, | ||
| 60 | - bottom: 8.0, | ||
| 61 | - child: MyButton( | ||
| 62 | - onPressed: () { | ||
| 63 | - NavigatorUtils.goBack(context); | ||
| 64 | - }, | ||
| 65 | - text: '完成', | ||
| 66 | - ), | ||
| 67 | - ), | ||
| 68 | - Positioned( | ||
| 69 | - top: 0.0, | ||
| 70 | - left: 0.0, | ||
| 71 | - right: 0.0, | ||
| 72 | - bottom: 64.0, | ||
| 73 | - child: ListView.builder( | ||
| 74 | - itemExtent: 114.0, | ||
| 75 | - padding: const EdgeInsets.only(left: 16.0, right: 16.0), | ||
| 76 | - itemBuilder: (_, index) => _buildItem(index), | ||
| 77 | - itemCount: _list.length, | ||
| 78 | - ), | ||
| 79 | - ), | ||
| 80 | - ], | ||
| 81 | - ), | ||
| 82 | - ), | ||
| 83 | - ); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - // 暂时没有对输入数据进行校验 | ||
| 87 | - Widget _buildItem(int index) { | ||
| 88 | - return _list[index].isAdd ? | ||
| 89 | - Semantics( | ||
| 90 | - label: '添加区间', | ||
| 91 | - child: GestureDetector( | ||
| 92 | - onTap: () { | ||
| 93 | - final FreightConfigModel config = _list[index - 1]; | ||
| 94 | - if (config.max.isNotEmpty && config.min.isNotEmpty) { | ||
| 95 | - setState(() { | ||
| 96 | - _list.insert(_list.length - 2, FreightConfigModel('', '', 1, false, '')); | ||
| 97 | - }); | ||
| 98 | - } else { | ||
| 99 | - Toast.show('请先完善上一个区间金额!'); | ||
| 100 | - return; | ||
| 101 | - } | ||
| 102 | - }, | ||
| 103 | - child: Container( | ||
| 104 | - key: const Key('add'), | ||
| 105 | - margin: const EdgeInsets.only(bottom: 8.0), | ||
| 106 | - padding: const EdgeInsets.symmetric(vertical: 32.0), | ||
| 107 | - decoration: BoxDecoration( | ||
| 108 | - color: context.isDark ? Colours.dark_bg_gray : Colours.bg_gray, | ||
| 109 | - borderRadius: BorderRadius.circular(8.0), | ||
| 110 | - ), | ||
| 111 | - child: const LoadAssetImage('shop/tj',), | ||
| 112 | - ), | ||
| 113 | - ), | ||
| 114 | - ) : | ||
| 115 | - Padding( | ||
| 116 | - padding: const EdgeInsets.only(bottom: 8.0), | ||
| 117 | - child: MyCard( | ||
| 118 | - child: Padding( | ||
| 119 | - padding: const EdgeInsets.all(15.0), | ||
| 120 | - child: Column( | ||
| 121 | - children: <Widget>[ | ||
| 122 | - Row( | ||
| 123 | - children: <Widget>[ | ||
| 124 | - Text(index == 0 ? '订单金额小于' : (index == _list.length - 1 ? '订单金额不小于' : '订单金额区间')), | ||
| 125 | - Expanded( | ||
| 126 | - child: Semantics( | ||
| 127 | - label: '填写订单金额', | ||
| 128 | - child: InkWell( | ||
| 129 | - onTap: () { | ||
| 130 | - if (index == 0 || index == _list.length - 1) { | ||
| 131 | - _showOrderPriceInputDialog(index); | ||
| 132 | - } else { | ||
| 133 | - _showRangePriceInputDialog(index); | ||
| 134 | - } | ||
| 135 | - }, | ||
| 136 | - child: Text( | ||
| 137 | - _getPriceText(index).isEmpty ? '订单金额' : _getPriceText(index), | ||
| 138 | - key: Key('订单金额$index'), | ||
| 139 | - textAlign: TextAlign.end, | ||
| 140 | - style: _getPriceText(index).isEmpty ? Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14) : null, | ||
| 141 | - ), | ||
| 142 | - ), | ||
| 143 | - )), | ||
| 144 | - Gaps.hGap5, | ||
| 145 | - const Text('元'), | ||
| 146 | - ], | ||
| 147 | - ), | ||
| 148 | - Gaps.vGap15, | ||
| 149 | - Gaps.line, | ||
| 150 | - Gaps.vGap15, | ||
| 151 | - Row( | ||
| 152 | - children: <Widget>[ | ||
| 153 | - Semantics( | ||
| 154 | - label: '选择比率', | ||
| 155 | - child: InkWell( | ||
| 156 | - onTap: () { | ||
| 157 | - setState(() { | ||
| 158 | - _list[index].type = 1; | ||
| 159 | - }); | ||
| 160 | - }, | ||
| 161 | - child: Row( | ||
| 162 | - mainAxisSize: MainAxisSize.min, | ||
| 163 | - children: <Widget>[ | ||
| 164 | - LoadAssetImage(_list[index].type == 1 ? 'shop/xzyf' : 'shop/wxzyf', width: 16.0,), | ||
| 165 | - Gaps.hGap4, | ||
| 166 | - const Text('比率'), | ||
| 167 | - ], | ||
| 168 | - ), | ||
| 169 | - ), | ||
| 170 | - ), | ||
| 171 | - Gaps.hGap16, | ||
| 172 | - Semantics( | ||
| 173 | - label: '选择金额', | ||
| 174 | - child: InkWell( | ||
| 175 | - onTap: () { | ||
| 176 | - setState(() { | ||
| 177 | - _list[index].type = 0; | ||
| 178 | - }); | ||
| 179 | - }, | ||
| 180 | - child: Row( | ||
| 181 | - mainAxisSize: MainAxisSize.min, | ||
| 182 | - children: <Widget>[ | ||
| 183 | - LoadAssetImage(_list[index].type == 0 ? 'shop/xzyf' : 'shop/wxzyf', width: 16.0), | ||
| 184 | - Gaps.hGap4, | ||
| 185 | - const Text('金额'), | ||
| 186 | - ], | ||
| 187 | - ), | ||
| 188 | - ), | ||
| 189 | - ), | ||
| 190 | - Expanded( | ||
| 191 | - child: Semantics( | ||
| 192 | - label: '填写${_list[index].type == 1 ? '运费比率' : '运费金额'}', | ||
| 193 | - child: InkWell( | ||
| 194 | - onTap: () => _showFreightInputDialog(index), | ||
| 195 | - child: Text( | ||
| 196 | - _list[index].price.isEmpty ? (_list[index].type == 1 ? '运费比率' : '运费金额'): _list[index].price, | ||
| 197 | - textAlign: TextAlign.end, | ||
| 198 | - style: _list[index].price.isEmpty ? Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14) : null, | ||
| 199 | - ), | ||
| 200 | - ), | ||
| 201 | - )), | ||
| 202 | - Gaps.hGap5, | ||
| 203 | - Text(_list[index].type == 1 ? '%' : '元'), | ||
| 204 | - ], | ||
| 205 | - ) | ||
| 206 | - ], | ||
| 207 | - ), | ||
| 208 | - ), | ||
| 209 | - ), | ||
| 210 | - ); | ||
| 211 | - } | ||
| 212 | - | ||
| 213 | - void _showOrderPriceInputDialog(int index) { | ||
| 214 | - showDialog<void>( | ||
| 215 | - context: context, | ||
| 216 | - barrierDismissible: false, | ||
| 217 | - builder: (BuildContext context) { | ||
| 218 | - return PriceInputDialog( | ||
| 219 | - title: '订单金额', | ||
| 220 | - onPressed: (value) { | ||
| 221 | - setState(() { | ||
| 222 | - if (index == 0) { | ||
| 223 | - _list[index].max = value; | ||
| 224 | - } else { | ||
| 225 | - _list[index].min = value; | ||
| 226 | - } | ||
| 227 | - }); | ||
| 228 | - }, | ||
| 229 | - ); | ||
| 230 | - } | ||
| 231 | - ); | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - void _showRangePriceInputDialog(int index) { | ||
| 235 | - showDialog<void>( | ||
| 236 | - context: context, | ||
| 237 | - barrierDismissible: false, | ||
| 238 | - builder: (BuildContext context) { | ||
| 239 | - return RangePriceInputDialog( | ||
| 240 | - title: '订单金额', | ||
| 241 | - onPressed: (min, max) { | ||
| 242 | - setState(() { | ||
| 243 | - _list[index].min = min; | ||
| 244 | - _list[index].max = max; | ||
| 245 | - }); | ||
| 246 | - }, | ||
| 247 | - ); | ||
| 248 | - } | ||
| 249 | - ); | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - void _showFreightInputDialog(int index) { | ||
| 253 | - showDialog<void>( | ||
| 254 | - context: context, | ||
| 255 | - barrierDismissible: false, | ||
| 256 | - builder: (BuildContext context) { | ||
| 257 | - return PriceInputDialog( | ||
| 258 | - title: _list[index].type == 1 ? '运费比率' : '运费金额', | ||
| 259 | - inputMaxPrice: _list[index].type == 1 ? 100 : 100000, | ||
| 260 | - onPressed: (value) { | ||
| 261 | - setState(() { | ||
| 262 | - _list[index].price = value; | ||
| 263 | - }); | ||
| 264 | - }, | ||
| 265 | - ); | ||
| 266 | - } | ||
| 267 | - ); | ||
| 268 | - } | ||
| 269 | - | ||
| 270 | - String _getPriceText(int index) { | ||
| 271 | - if (index == 0) { | ||
| 272 | - if (_list[index].max.isEmpty) { | ||
| 273 | - return ''; | ||
| 274 | - } else { | ||
| 275 | - return _list[index].max; | ||
| 276 | - } | ||
| 277 | - } else if (index == _list.length - 1) { | ||
| 278 | - if (_list[index].min.isEmpty) { | ||
| 279 | - return ''; | ||
| 280 | - } else { | ||
| 281 | - return _list[index].min; | ||
| 282 | - } | ||
| 283 | - } else { | ||
| 284 | - if (_list[index].min.isEmpty || _list[index].max.isEmpty) { | ||
| 285 | - return ''; | ||
| 286 | - } else { | ||
| 287 | - return '${_list[index].min}~${_list[index].max}'; | ||
| 288 | - } | ||
| 289 | - } | ||
| 290 | - } | ||
| 291 | -} |
lib/shop/page/input_text_page.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter/services.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 5 | - | ||
| 6 | - | ||
| 7 | -/// design/7店铺-店铺配置/index.html#artboard13 | ||
| 8 | -class InputTextPage extends StatefulWidget { | ||
| 9 | - | ||
| 10 | - const InputTextPage({ | ||
| 11 | - Key? key, | ||
| 12 | - required this.title, | ||
| 13 | - this.content, | ||
| 14 | - this.hintText, | ||
| 15 | - this.keyboardType = TextInputType.text, | ||
| 16 | - }) : super(key : key); | ||
| 17 | - | ||
| 18 | - final String title; | ||
| 19 | - final String? content; | ||
| 20 | - final String? hintText; | ||
| 21 | - final TextInputType? keyboardType; | ||
| 22 | - | ||
| 23 | - @override | ||
| 24 | - _InputTextPageState createState() => _InputTextPageState(); | ||
| 25 | -} | ||
| 26 | - | ||
| 27 | -class _InputTextPageState extends State<InputTextPage> { | ||
| 28 | - | ||
| 29 | - final TextEditingController _controller = TextEditingController(); | ||
| 30 | - List<TextInputFormatter>? _inputFormatters; | ||
| 31 | - late int _maxLength; | ||
| 32 | - | ||
| 33 | - @override | ||
| 34 | - void initState() { | ||
| 35 | - super.initState(); | ||
| 36 | - _controller.text = widget.content ?? ''; | ||
| 37 | - _maxLength = widget.keyboardType == TextInputType.phone ? 11 : 30; | ||
| 38 | - _inputFormatters = widget.keyboardType == TextInputType.phone ? [FilteringTextInputFormatter.allow(RegExp('[0-9]'))] : null; | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - @override | ||
| 42 | - void dispose() { | ||
| 43 | - _controller.dispose(); | ||
| 44 | - super.dispose(); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - @override | ||
| 48 | - Widget build(BuildContext context) { | ||
| 49 | - return Scaffold( | ||
| 50 | - appBar: MyAppBar( | ||
| 51 | - title: widget.title, | ||
| 52 | - actionName: '完成', | ||
| 53 | - onPressed: () { | ||
| 54 | - NavigatorUtils.goBackWithParams(context, _controller.text); | ||
| 55 | - }, | ||
| 56 | - ), | ||
| 57 | - body: Padding( | ||
| 58 | - padding: const EdgeInsets.only(top: 21.0, left: 16.0, right: 16.0, bottom: 16.0), | ||
| 59 | - child: Semantics( | ||
| 60 | - multiline: true, | ||
| 61 | - maxValueLength: _maxLength, | ||
| 62 | - child: TextField( | ||
| 63 | - maxLength: _maxLength, | ||
| 64 | - maxLines: 5, | ||
| 65 | - autofocus: true, | ||
| 66 | - controller: _controller, | ||
| 67 | - keyboardType: widget.keyboardType, | ||
| 68 | - inputFormatters: _inputFormatters, | ||
| 69 | - decoration: InputDecoration( | ||
| 70 | - hintText: widget.hintText, | ||
| 71 | - border: InputBorder.none, | ||
| 72 | - ), | ||
| 73 | - ), | ||
| 74 | - ), | ||
| 75 | - ), | ||
| 76 | - ); | ||
| 77 | - } | ||
| 78 | -} |
lib/shop/page/message_page.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/cupertino.dart'; | ||
| 2 | -import 'package:flutter/material.dart'; | ||
| 3 | -import 'package:one_poem/res/resources.dart'; | ||
| 4 | -import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 5 | -import 'package:one_poem/widgets/my_card.dart'; | ||
| 6 | - | ||
| 7 | -/// design/8设置/index.html#artboard2 | ||
| 8 | -class MessagePage extends StatefulWidget { | ||
| 9 | - | ||
| 10 | - const MessagePage({Key? key}) : super(key: key); | ||
| 11 | - | ||
| 12 | - @override | ||
| 13 | - _MessagePageState createState() => _MessagePageState(); | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -class _MessagePageState extends State<MessagePage> { | ||
| 17 | - | ||
| 18 | - final ScrollController _scrollController = ScrollController(); | ||
| 19 | - | ||
| 20 | - @override | ||
| 21 | - void dispose() { | ||
| 22 | - _scrollController.dispose(); | ||
| 23 | - super.dispose(); | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - @override | ||
| 27 | - Widget build(BuildContext context) { | ||
| 28 | - return Scaffold( | ||
| 29 | - appBar: MyAppBar( | ||
| 30 | - centerTitle: '消息', | ||
| 31 | - actionName: '全部已读', | ||
| 32 | - onPressed: () {}, | ||
| 33 | - ), | ||
| 34 | - body: Scrollbar( // 加个滚动条 | ||
| 35 | - controller: _scrollController, | ||
| 36 | - child: ListView.builder( | ||
| 37 | - itemCount: 20, | ||
| 38 | - controller: _scrollController, | ||
| 39 | - physics: const AlwaysScrollableScrollPhysics(), | ||
| 40 | - padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 28.0), | ||
| 41 | - itemBuilder: (_, __) => _MessageItem(), | ||
| 42 | - ), | ||
| 43 | - ), | ||
| 44 | - ); | ||
| 45 | - } | ||
| 46 | -} | ||
| 47 | - | ||
| 48 | - | ||
| 49 | -class _MessageItem extends StatefulWidget { | ||
| 50 | - @override | ||
| 51 | - _MessageItemState createState() => _MessageItemState(); | ||
| 52 | -} | ||
| 53 | - | ||
| 54 | -class _MessageItemState extends State<_MessageItem> { | ||
| 55 | - @override | ||
| 56 | - Widget build(BuildContext context) { | ||
| 57 | - return Column( | ||
| 58 | - children: <Widget>[ | ||
| 59 | - Gaps.vGap15, | ||
| 60 | - Text('2021-5-31 17:19:36', style: Theme.of(context).textTheme.subtitle2), | ||
| 61 | - Gaps.vGap8, | ||
| 62 | - MyCard( | ||
| 63 | - child: Padding( | ||
| 64 | - padding: const EdgeInsets.all(16.0), | ||
| 65 | - child: Column( | ||
| 66 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 67 | - children: <Widget>[ | ||
| 68 | - Row( | ||
| 69 | - children: <Widget>[ | ||
| 70 | - const Expanded(child: Text('系统通知')), | ||
| 71 | - Container( | ||
| 72 | - margin: const EdgeInsets.only(right: 4.0), | ||
| 73 | - height: 8.0, | ||
| 74 | - width: 8.0, | ||
| 75 | - decoration: BoxDecoration( | ||
| 76 | - color: Colours.app_main, | ||
| 77 | - borderRadius: BorderRadius.circular(4.0), | ||
| 78 | - ), | ||
| 79 | - ), | ||
| 80 | - Images.arrowRight, | ||
| 81 | - ], | ||
| 82 | - ), | ||
| 83 | - Gaps.vGap8, | ||
| 84 | - Gaps.line, | ||
| 85 | - Gaps.vGap8, | ||
| 86 | - const Text('供货商由于[商品缺货]原因,取消了采购订单。', style: TextStyles.textSize12), | ||
| 87 | - ], | ||
| 88 | - ), | ||
| 89 | - ), | ||
| 90 | - ) | ||
| 91 | - ], | ||
| 92 | - ); | ||
| 93 | - } | ||
| 94 | -} |
lib/shop/page/shop_page.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/account/account_router.dart'; | ||
| 3 | -import 'package:one_poem/account/models/user_entity.dart'; | ||
| 4 | -import 'package:one_poem/mvp/base_page.dart'; | ||
| 5 | -import 'package:one_poem/res/resources.dart'; | ||
| 6 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 7 | -import 'package:one_poem/setting/setting_router.dart'; | ||
| 8 | -import 'package:one_poem/shop/iview/shop_iview.dart'; | ||
| 9 | -import 'package:one_poem/shop/presenter/shop_presenter.dart'; | ||
| 10 | -import 'package:one_poem/shop/provider/user_provider.dart'; | ||
| 11 | -import 'package:one_poem/util/image_utils.dart'; | ||
| 12 | -import 'package:one_poem/util/theme_utils.dart'; | ||
| 13 | -import 'package:one_poem/widgets/load_image.dart'; | ||
| 14 | -import 'package:provider/provider.dart'; | ||
| 15 | - | ||
| 16 | -import '../shop_router.dart'; | ||
| 17 | - | ||
| 18 | -/// design/6店铺-账户/index.html#artboard0 | ||
| 19 | -class ShopPage extends StatefulWidget { | ||
| 20 | - | ||
| 21 | - const ShopPage({ | ||
| 22 | - Key? key, | ||
| 23 | - this.isAccessibilityTest = false, | ||
| 24 | - }) : super(key : key); | ||
| 25 | - | ||
| 26 | - final bool isAccessibilityTest; | ||
| 27 | - | ||
| 28 | - @override | ||
| 29 | - _ShopPageState createState() => _ShopPageState(); | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -class _ShopPageState extends State<ShopPage> with BasePageMixin<ShopPage, ShopPagePresenter>, AutomaticKeepAliveClientMixin<ShopPage> implements ShopIMvpView { | ||
| 33 | - | ||
| 34 | - final List<String> _menuTitle = ['账户流水', '资金管理', '提现账号']; | ||
| 35 | - final List<String> _menuImage = ['zhls', 'zjgl', 'txzh']; | ||
| 36 | - final List<String> _menuDarkImage = ['dark_zhls', 'dark_zjgl', 'dark_txzh']; | ||
| 37 | - | ||
| 38 | - UserProvider provider = UserProvider(); | ||
| 39 | - | ||
| 40 | - @override | ||
| 41 | - void setUser(UserEntity? user) { | ||
| 42 | - provider.setUser(user); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - @override | ||
| 46 | - bool get isAccessibilityTest => widget.isAccessibilityTest; | ||
| 47 | - | ||
| 48 | - @override | ||
| 49 | - Widget build(BuildContext context) { | ||
| 50 | - super.build(context); | ||
| 51 | - final Color? _iconColor = ThemeUtils.getIconColor(context); | ||
| 52 | - final Widget line = Container( | ||
| 53 | - height: 0.6, | ||
| 54 | - width: double.infinity, | ||
| 55 | - margin: const EdgeInsets.only(left: 16.0), | ||
| 56 | - child: Gaps.line, | ||
| 57 | - ); | ||
| 58 | - return ChangeNotifierProvider<UserProvider>( | ||
| 59 | - create: (_) => provider, | ||
| 60 | - child: Scaffold( | ||
| 61 | - appBar: AppBar( | ||
| 62 | - actions: <Widget>[ | ||
| 63 | - IconButton( | ||
| 64 | - tooltip: '消息', | ||
| 65 | - onPressed: () { | ||
| 66 | - NavigatorUtils.push(context, ShopRouter.messagePage); | ||
| 67 | - }, | ||
| 68 | - icon: LoadAssetImage( | ||
| 69 | - 'shop/message', | ||
| 70 | - key: const Key('message'), | ||
| 71 | - width: 24.0, | ||
| 72 | - height: 24.0, | ||
| 73 | - color: _iconColor, | ||
| 74 | - ), | ||
| 75 | - ), | ||
| 76 | - IconButton( | ||
| 77 | - tooltip: '设置', | ||
| 78 | - onPressed: () { | ||
| 79 | - NavigatorUtils.push(context, SettingRouter.settingPage); | ||
| 80 | - }, | ||
| 81 | - icon: LoadAssetImage( | ||
| 82 | - 'shop/setting', | ||
| 83 | - key: const Key('setting'), | ||
| 84 | - width: 24.0, | ||
| 85 | - height: 24.0, | ||
| 86 | - color: _iconColor, | ||
| 87 | - ), | ||
| 88 | - ) | ||
| 89 | - ], | ||
| 90 | - ), | ||
| 91 | - body: Column( | ||
| 92 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 93 | - children: <Widget>[ | ||
| 94 | - Gaps.vGap12, | ||
| 95 | - Consumer<UserProvider>( | ||
| 96 | - builder: (_, provider, child) { | ||
| 97 | - final Widget header = Stack( | ||
| 98 | - children: <Widget>[ | ||
| 99 | - const SizedBox(width: double.infinity, height: 56.0), | ||
| 100 | - const Text( | ||
| 101 | - '官方直营店', | ||
| 102 | - style: TextStyles.textBold24, | ||
| 103 | - ), | ||
| 104 | - Positioned( | ||
| 105 | - right: 0.0, | ||
| 106 | - child: CircleAvatar( | ||
| 107 | - radius: 28.0, | ||
| 108 | - backgroundColor: Colors.transparent, | ||
| 109 | - backgroundImage: ImageUtils.getImageProvider(provider.user?.avatar, holderImg: 'shop/tx'), | ||
| 110 | - ), | ||
| 111 | - ), | ||
| 112 | - child!, | ||
| 113 | - ], | ||
| 114 | - ); | ||
| 115 | - return Padding( | ||
| 116 | - padding: const EdgeInsets.symmetric(horizontal: 16.0), | ||
| 117 | - child: MergeSemantics( | ||
| 118 | - child: header, | ||
| 119 | - ), | ||
| 120 | - ); | ||
| 121 | - }, | ||
| 122 | - child: Positioned( | ||
| 123 | - top: 38.0, | ||
| 124 | - left: 0.0, | ||
| 125 | - child: Row( | ||
| 126 | - children: const <Widget>[ | ||
| 127 | - LoadAssetImage('shop/zybq', width: 40.0, height: 16.0,), | ||
| 128 | - Gaps.hGap8, | ||
| 129 | - Text('店铺账号:15000000000', style: TextStyles.textSize12) | ||
| 130 | - ], | ||
| 131 | - ), | ||
| 132 | - ), | ||
| 133 | - ), | ||
| 134 | - Gaps.vGap24, | ||
| 135 | - line, | ||
| 136 | - Gaps.vGap24, | ||
| 137 | - const MergeSemantics( | ||
| 138 | - child: Padding( | ||
| 139 | - padding: EdgeInsets.symmetric(horizontal: 16.0), | ||
| 140 | - child: Text( | ||
| 141 | - '账户', | ||
| 142 | - style: TextStyles.textBold18, | ||
| 143 | - ), | ||
| 144 | - ), | ||
| 145 | - ), | ||
| 146 | - _ShopFunctionModule( | ||
| 147 | - data: _menuTitle, | ||
| 148 | - image: _menuImage, | ||
| 149 | - darkImage: _menuDarkImage, | ||
| 150 | - onItemClick: (index) { | ||
| 151 | - if (index == 0) { | ||
| 152 | - NavigatorUtils.push(context, AccountRouter.accountPage); | ||
| 153 | - } else if (index == 1) { | ||
| 154 | - NavigatorUtils.push(context, AccountRouter.accountPage); | ||
| 155 | - } else if (index == 2) { | ||
| 156 | - NavigatorUtils.push(context, AccountRouter.accountPage); | ||
| 157 | - } | ||
| 158 | - }, | ||
| 159 | - ), | ||
| 160 | - line, | ||
| 161 | - Gaps.vGap24, | ||
| 162 | - const MergeSemantics( | ||
| 163 | - child: Padding( | ||
| 164 | - padding: EdgeInsets.symmetric(horizontal: 16.0), | ||
| 165 | - child: Text( | ||
| 166 | - '店铺', | ||
| 167 | - style: TextStyles.textBold18, | ||
| 168 | - ), | ||
| 169 | - ), | ||
| 170 | - ), | ||
| 171 | - /// 使用Flexible防止溢出 | ||
| 172 | - Flexible( | ||
| 173 | - child: _ShopFunctionModule( | ||
| 174 | - data: const ['店铺设置'], | ||
| 175 | - image: const ['dpsz'], | ||
| 176 | - darkImage: const ['dark_dpsz'], | ||
| 177 | - onItemClick: (index) { | ||
| 178 | - NavigatorUtils.push(context, ShopRouter.shopSettingPage); | ||
| 179 | - }, | ||
| 180 | - ), | ||
| 181 | - ), | ||
| 182 | - ], | ||
| 183 | - ), | ||
| 184 | - ), | ||
| 185 | - ); | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - @override | ||
| 189 | - bool get wantKeepAlive => true; | ||
| 190 | - | ||
| 191 | - @override | ||
| 192 | - ShopPagePresenter createPresenter() => ShopPagePresenter(); | ||
| 193 | - | ||
| 194 | -} | ||
| 195 | - | ||
| 196 | -class _ShopFunctionModule extends StatelessWidget { | ||
| 197 | - | ||
| 198 | - const _ShopFunctionModule({ | ||
| 199 | - Key? key, | ||
| 200 | - required this.onItemClick, | ||
| 201 | - required this.data, | ||
| 202 | - required this.image, | ||
| 203 | - required this.darkImage, | ||
| 204 | - }): super(key: key); | ||
| 205 | - | ||
| 206 | - final Function(int index) onItemClick; | ||
| 207 | - final List<String> data; | ||
| 208 | - final List<String> image; | ||
| 209 | - final List<String> darkImage; | ||
| 210 | - | ||
| 211 | - @override | ||
| 212 | - Widget build(BuildContext context) { | ||
| 213 | - return GridView.builder( | ||
| 214 | - shrinkWrap: true, | ||
| 215 | - padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 12.0), | ||
| 216 | - physics: const NeverScrollableScrollPhysics(), | ||
| 217 | - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( | ||
| 218 | - crossAxisCount: 4, | ||
| 219 | - childAspectRatio: 1.18, | ||
| 220 | - ), | ||
| 221 | - itemCount: data.length, | ||
| 222 | - itemBuilder: (_, index) { | ||
| 223 | - return InkWell( | ||
| 224 | - child: Column( | ||
| 225 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 226 | - children: <Widget>[ | ||
| 227 | - LoadAssetImage(context.isDark ? 'shop/${darkImage[index]}' : 'shop/${image[index]}', width: 32.0), | ||
| 228 | - Gaps.vGap4, | ||
| 229 | - Text( | ||
| 230 | - data[index], | ||
| 231 | - style: TextStyles.textSize12, | ||
| 232 | - ) | ||
| 233 | - ], | ||
| 234 | - ), | ||
| 235 | - onTap: () { | ||
| 236 | - onItemClick(index); | ||
| 237 | - }, | ||
| 238 | - ); | ||
| 239 | - }, | ||
| 240 | - ); | ||
| 241 | - } | ||
| 242 | -} |
lib/shop/page/shop_setting_page.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/res/resources.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/shop/widgets/pay_type_dialog.dart'; | ||
| 5 | -import 'package:one_poem/shop/widgets/price_input_dialog.dart'; | ||
| 6 | -import 'package:one_poem/shop/widgets/send_type_dialog.dart'; | ||
| 7 | -import 'package:one_poem/util/other_utils.dart'; | ||
| 8 | -import 'package:one_poem/widgets/click_item.dart'; | ||
| 9 | -import 'package:one_poem/widgets/my_app_bar.dart'; | ||
| 10 | -import 'package:one_poem/widgets/my_button.dart'; | ||
| 11 | -import 'package:one_poem/widgets/my_scroll_view.dart'; | ||
| 12 | - | ||
| 13 | -import '../shop_router.dart'; | ||
| 14 | - | ||
| 15 | -/// design/7店铺-店铺配置/index.html#artboard17 | ||
| 16 | -class ShopSettingPage extends StatefulWidget { | ||
| 17 | - | ||
| 18 | - const ShopSettingPage({Key? key}) : super(key: key); | ||
| 19 | - | ||
| 20 | - @override | ||
| 21 | - _ShopSettingPageState createState() => _ShopSettingPageState(); | ||
| 22 | -} | ||
| 23 | - | ||
| 24 | -class _ShopSettingPageState extends State<ShopSettingPage> { | ||
| 25 | - | ||
| 26 | - bool _check = false; | ||
| 27 | - List<int> _selectValue = [0]; | ||
| 28 | - int _sendType = 0; | ||
| 29 | - String _sendPrice = '0.00'; | ||
| 30 | - String _freePrice = '0.00'; | ||
| 31 | - String _phone = ''; | ||
| 32 | - String _shopIntroduction = '零食铺子坚果饮料美酒佳肴…'; | ||
| 33 | - String _securityService = '假一赔十'; | ||
| 34 | - String _address = '陕西省 西安市 长安区 郭杜镇郭北村韩林路圣方医院斜对面'; | ||
| 35 | - | ||
| 36 | - @override | ||
| 37 | - Widget build(BuildContext context) { | ||
| 38 | - return Scaffold( | ||
| 39 | - // 防止键盘弹出,提交按钮升起。。。 | ||
| 40 | - resizeToAvoidBottomInset: false, | ||
| 41 | - appBar: const MyAppBar(), | ||
| 42 | - body: MyScrollView( | ||
| 43 | - padding: const EdgeInsets.symmetric(vertical: 16.0), | ||
| 44 | - bottomButton: Padding( | ||
| 45 | - padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 8.0), | ||
| 46 | - child: MyButton( | ||
| 47 | - text: '提交', | ||
| 48 | - onPressed: () => NavigatorUtils.goBack(context), | ||
| 49 | - ), | ||
| 50 | - ), | ||
| 51 | - children: <Widget>[ | ||
| 52 | - Gaps.vGap5, | ||
| 53 | - Row( | ||
| 54 | - children: <Widget>[ | ||
| 55 | - Gaps.hGap16, | ||
| 56 | - Text( | ||
| 57 | - _check ? '正在营业' : '暂停营业', | ||
| 58 | - style: TextStyles.textBold24, | ||
| 59 | - ), | ||
| 60 | - const Spacer(), | ||
| 61 | - Semantics( | ||
| 62 | - label: '店铺营业开关', | ||
| 63 | - child: Switch.adaptive( | ||
| 64 | - value: _check, | ||
| 65 | - onChanged: (bool val) { | ||
| 66 | - setState(() { | ||
| 67 | - _check = val; | ||
| 68 | - }); | ||
| 69 | - }, | ||
| 70 | - ), | ||
| 71 | - ), | ||
| 72 | - Gaps.hGap4, | ||
| 73 | - ], | ||
| 74 | - ), | ||
| 75 | - Gaps.vGap32, | ||
| 76 | - const Padding( | ||
| 77 | - padding: EdgeInsets.only(left: 16.0), | ||
| 78 | - child: Text('基础设置', style: TextStyles.textBold18), | ||
| 79 | - ), | ||
| 80 | - Gaps.vGap16, | ||
| 81 | - ClickItem( | ||
| 82 | - title: '店铺简介', | ||
| 83 | - content: _shopIntroduction, | ||
| 84 | - onTap: () { | ||
| 85 | - _goInputTextPage(context, '店铺简介', '这里有一段完美的简介…', _shopIntroduction, (result) { | ||
| 86 | - setState(() { | ||
| 87 | - _shopIntroduction = result.toString(); | ||
| 88 | - }); | ||
| 89 | - },); | ||
| 90 | - }, | ||
| 91 | - ), | ||
| 92 | - ClickItem( | ||
| 93 | - title: '保障服务', | ||
| 94 | - content: _securityService, | ||
| 95 | - onTap: () { | ||
| 96 | - _goInputTextPage(context, '保障服务', '这里有一段完美的说明…', _securityService, (result) { | ||
| 97 | - setState(() { | ||
| 98 | - _securityService = result.toString(); | ||
| 99 | - }); | ||
| 100 | - },); | ||
| 101 | - }, | ||
| 102 | - ), | ||
| 103 | - ClickItem( | ||
| 104 | - title: '支付方式', | ||
| 105 | - content: _getPayType(), | ||
| 106 | - onTap: _showPayTypeDialog, | ||
| 107 | - ), | ||
| 108 | - Gaps.vGap32, | ||
| 109 | - const Padding( | ||
| 110 | - padding: EdgeInsets.only(left: 16.0), | ||
| 111 | - child: Text('运费设置', style: TextStyles.textBold18), | ||
| 112 | - ), | ||
| 113 | - Gaps.vGap16, | ||
| 114 | - ClickItem( | ||
| 115 | - title: '运费配置', | ||
| 116 | - content: _sendType == 0 ? '运费满免配置' : '运费比例配置', | ||
| 117 | - onTap: _showSendTypeDialog, | ||
| 118 | - ), | ||
| 119 | - Visibility( | ||
| 120 | - visible: _sendType != 1, | ||
| 121 | - child: ClickItem( | ||
| 122 | - title: '运费满免', | ||
| 123 | - content: _freePrice, | ||
| 124 | - onTap: () { | ||
| 125 | - _showInputDialog('配送费满免', (value) { | ||
| 126 | - setState(() { | ||
| 127 | - _freePrice = value; | ||
| 128 | - }); | ||
| 129 | - }); | ||
| 130 | - }, | ||
| 131 | - ), | ||
| 132 | - ), | ||
| 133 | - Visibility( | ||
| 134 | - visible: _sendType != 1, | ||
| 135 | - child: ClickItem( | ||
| 136 | - title: '配送费用', | ||
| 137 | - content: _sendPrice, | ||
| 138 | - onTap: () { | ||
| 139 | - _showInputDialog('配送费用', (value) { | ||
| 140 | - setState(() { | ||
| 141 | - _sendPrice = value; | ||
| 142 | - }); | ||
| 143 | - }); | ||
| 144 | - }, | ||
| 145 | - ), | ||
| 146 | - ), | ||
| 147 | - Visibility( | ||
| 148 | - visible: _sendType != 0, | ||
| 149 | - child: ClickItem( | ||
| 150 | - maxLines: 10, | ||
| 151 | - title: '运费比例', | ||
| 152 | - content: '1、订单金额<20元,配送费为订单金额的1%\n2、订单金额≥20元,配送费为订单金额的1%', | ||
| 153 | - onTap: () => NavigatorUtils.push(context, ShopRouter.freightConfigPage), | ||
| 154 | - ), | ||
| 155 | - ), | ||
| 156 | - Gaps.vGap32, | ||
| 157 | - const Padding( | ||
| 158 | - padding: EdgeInsets.only(left: 16.0), | ||
| 159 | - child: Text('联系信息', style: TextStyles.textBold18,), | ||
| 160 | - ), | ||
| 161 | - Gaps.vGap16, | ||
| 162 | - ClickItem( | ||
| 163 | - title: '联系电话', | ||
| 164 | - content: _phone, | ||
| 165 | - onTap: () { | ||
| 166 | - _goInputTextPage(context, '联系电话', '这里有一串神秘的数字…', _phone, (result) { | ||
| 167 | - setState(() { | ||
| 168 | - _phone = result.toString(); | ||
| 169 | - }); | ||
| 170 | - }, keyboardType: TextInputType.phone,); | ||
| 171 | - }, | ||
| 172 | - ), | ||
| 173 | - ClickItem( | ||
| 174 | - maxLines: 2, | ||
| 175 | - title: '店铺地址', | ||
| 176 | - content: _address, | ||
| 177 | - onTap: () { | ||
| 178 | - // NavigatorUtils.pushResult(context, ShopRouter.addressSelectPage, (result) { | ||
| 179 | - // setState(() { | ||
| 180 | - // final PoiSearch model = result as PoiSearch; | ||
| 181 | - // _address = '${model.provinceName.nullSafe} ${model.cityName.nullSafe} ${model.adName.nullSafe} ${model.title.nullSafe}'; | ||
| 182 | - // }); | ||
| 183 | - // }); | ||
| 184 | - }, | ||
| 185 | - ), | ||
| 186 | - Gaps.vGap8, | ||
| 187 | - ], | ||
| 188 | - ) | ||
| 189 | - ); | ||
| 190 | - } | ||
| 191 | - | ||
| 192 | - String _getPayType() { | ||
| 193 | - String payType = ''; | ||
| 194 | - for (final int s in _selectValue) { | ||
| 195 | - if (s == 0) { | ||
| 196 | - payType = '$payType在线支付+'; | ||
| 197 | - } else if (s == 1) { | ||
| 198 | - payType = '$payType对公转账+'; | ||
| 199 | - } else if (s == 2) { | ||
| 200 | - payType = '$payType货到付款+'; | ||
| 201 | - } | ||
| 202 | - } | ||
| 203 | - return payType.substring(0, payType.length - 1); | ||
| 204 | - } | ||
| 205 | - | ||
| 206 | - void _goInputTextPage(BuildContext context, String title, | ||
| 207 | - String hintText, String content, Function(Object?) function, | ||
| 208 | - {TextInputType? keyboardType}) { | ||
| 209 | - | ||
| 210 | - NavigatorUtils.pushResult(context, | ||
| 211 | - ShopRouter.inputTextPage, function, | ||
| 212 | - arguments: InputTextPageArgumentsData( | ||
| 213 | - title: title, | ||
| 214 | - hintText: hintText, | ||
| 215 | - content: content, | ||
| 216 | - keyboardType: keyboardType, | ||
| 217 | - ) | ||
| 218 | - ); | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - void _showInputDialog(String title, Function(String) onPressed) { | ||
| 222 | - showDialog<void>( | ||
| 223 | - context: context, | ||
| 224 | - barrierDismissible: false, | ||
| 225 | - builder: (BuildContext context) { | ||
| 226 | - return PriceInputDialog( | ||
| 227 | - title: title, | ||
| 228 | - onPressed: onPressed, | ||
| 229 | - ); | ||
| 230 | - }, | ||
| 231 | - ); | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - void _showPayTypeDialog() { | ||
| 235 | - showElasticDialog<void>( | ||
| 236 | - context: context, | ||
| 237 | - barrierDismissible: false, | ||
| 238 | - builder: (BuildContext context) { | ||
| 239 | - return PayTypeDialog( | ||
| 240 | - value: _selectValue, | ||
| 241 | - onPressed: (value) { | ||
| 242 | - setState(() { | ||
| 243 | - _selectValue = value.cast<int>(); | ||
| 244 | - }); | ||
| 245 | - }, | ||
| 246 | - ); | ||
| 247 | - }, | ||
| 248 | - ); | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | - void _showSendTypeDialog() { | ||
| 252 | - showElasticDialog<void>( | ||
| 253 | - context: context, | ||
| 254 | - barrierDismissible: false, | ||
| 255 | - builder: (BuildContext context) { | ||
| 256 | - return SendTypeDialog( | ||
| 257 | - onPressed: (i, value) { | ||
| 258 | - setState(() { | ||
| 259 | - _sendType = i; | ||
| 260 | - }); | ||
| 261 | - }, | ||
| 262 | - ); | ||
| 263 | - }, | ||
| 264 | - ); | ||
| 265 | - } | ||
| 266 | -} | ||
| 267 | - | ||
| 268 | - | ||
| 269 | -class InputTextPageArgumentsData { | ||
| 270 | - | ||
| 271 | - InputTextPageArgumentsData({ | ||
| 272 | - required this.title, | ||
| 273 | - this.content, | ||
| 274 | - this.hintText, | ||
| 275 | - this.keyboardType, | ||
| 276 | -}); | ||
| 277 | - | ||
| 278 | - late String title; | ||
| 279 | - late String? content; | ||
| 280 | - late String? hintText; | ||
| 281 | - late TextInputType? keyboardType; | ||
| 282 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/account/models/user_entity.dart'; | ||
| 3 | -import 'package:one_poem/mvp/base_page_presenter.dart'; | ||
| 4 | -import 'package:one_poem/net/dio_utils.dart'; | ||
| 5 | -import 'package:one_poem/net/http_api.dart'; | ||
| 6 | -import 'package:one_poem/shop/iview/shop_iview.dart'; | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -class ShopPagePresenter extends BasePagePresenter<ShopIMvpView> { | ||
| 10 | - | ||
| 11 | - @override | ||
| 12 | - void initState() { | ||
| 13 | - WidgetsBinding.instance!.addPostFrameCallback((_) { | ||
| 14 | - if (view.isAccessibilityTest) { | ||
| 15 | - return; | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - /// 接口请求例子 | ||
| 19 | - /// get请求参数queryParameters post请求参数params | ||
| 20 | - asyncRequestNetwork<UserEntity>(Method.get, | ||
| 21 | - url: HttpApi.users, | ||
| 22 | - onSuccess: (data) { | ||
| 23 | - view.setUser(data); | ||
| 24 | - }, | ||
| 25 | - ); | ||
| 26 | - }); | ||
| 27 | - } | ||
| 28 | -} |
lib/shop/provider/user_provider.dart
deleted
100644 → 0
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/account/models/user_entity.dart'; | ||
| 3 | - | ||
| 4 | -class UserProvider extends ChangeNotifier { | ||
| 5 | - | ||
| 6 | - UserEntity? _user; | ||
| 7 | - UserEntity? get user => _user; | ||
| 8 | - | ||
| 9 | - void setUser(UserEntity? user) { | ||
| 10 | - _user = user; | ||
| 11 | - notifyListeners(); | ||
| 12 | - } | ||
| 13 | -} |
lib/shop/shop_router.dart
deleted
100644 → 0
| 1 | -import 'package:fluro/fluro.dart'; | ||
| 2 | -import 'package:one_poem/routers/i_router.dart'; | ||
| 3 | - | ||
| 4 | -import 'page/freight_config_page.dart'; | ||
| 5 | -import 'page/input_text_page.dart'; | ||
| 6 | -import 'page/message_page.dart'; | ||
| 7 | -import 'page/shop_page.dart'; | ||
| 8 | -import 'page/shop_setting_page.dart'; | ||
| 9 | - | ||
| 10 | -class ShopRouter implements IRouterProvider{ | ||
| 11 | - | ||
| 12 | - static String shopPage = '/shop'; | ||
| 13 | - static String shopSettingPage = '/shop/shopSetting'; | ||
| 14 | - static String messagePage = '/shop/message'; | ||
| 15 | - static String freightConfigPage = '/shop/freightConfig'; | ||
| 16 | - static String addressSelectPage = '/shop/addressSelect'; | ||
| 17 | - static String inputTextPage = '/shop/inputText'; | ||
| 18 | - | ||
| 19 | - @override | ||
| 20 | - void initRouter(FluroRouter router) { | ||
| 21 | - router.define(shopPage, handler: Handler(handlerFunc: (_, __) => const ShopPage())); | ||
| 22 | - router.define(shopSettingPage, handler: Handler(handlerFunc: (_, __) => const ShopSettingPage())); | ||
| 23 | - router.define(messagePage, handler: Handler(handlerFunc: (_, __) => const MessagePage())); | ||
| 24 | - router.define(freightConfigPage, handler: Handler(handlerFunc: (_, __) => const FreightConfigPage())); | ||
| 25 | - router.define(inputTextPage, handler: Handler(handlerFunc: (context, params) { | ||
| 26 | - /// 类参数 | ||
| 27 | - final args = context!.settings!.arguments! as InputTextPageArgumentsData; | ||
| 28 | - return InputTextPage( | ||
| 29 | - title: args.title, | ||
| 30 | - hintText: args.hintText, | ||
| 31 | - content: args.content, | ||
| 32 | - keyboardType: args.keyboardType, | ||
| 33 | - ); | ||
| 34 | - })); | ||
| 35 | - } | ||
| 36 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/res/resources.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/util/toast_utils.dart'; | ||
| 5 | -import 'package:one_poem/widgets/base_dialog.dart'; | ||
| 6 | -import 'package:one_poem/widgets/load_image.dart'; | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -/// design/7店铺-店铺配置/index.html#artboard10 | ||
| 10 | -class PayTypeDialog extends StatefulWidget { | ||
| 11 | - | ||
| 12 | - const PayTypeDialog({ | ||
| 13 | - Key? key, | ||
| 14 | - this.value, | ||
| 15 | - required this.onPressed, | ||
| 16 | - }) : super(key : key); | ||
| 17 | - | ||
| 18 | - final List<int>? value; | ||
| 19 | - final Function(List<int>) onPressed; | ||
| 20 | - | ||
| 21 | - @override | ||
| 22 | - _PayTypeDialog createState() => _PayTypeDialog(); | ||
| 23 | - | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | -class _PayTypeDialog extends State<PayTypeDialog> { | ||
| 27 | - | ||
| 28 | - late List<int> _selectValue; | ||
| 29 | - final List<String> _list = <String>['线上支付', '对公转账', '货到付款']; | ||
| 30 | - | ||
| 31 | - Widget _buildItem(int index) { | ||
| 32 | - _selectValue = widget.value ?? <int>[0]; | ||
| 33 | - return Material( | ||
| 34 | - type: MaterialType.transparency, | ||
| 35 | - child: InkWell( | ||
| 36 | - child: SizedBox( | ||
| 37 | - height: 42.0, | ||
| 38 | - child: Row( | ||
| 39 | - children: <Widget>[ | ||
| 40 | - Gaps.hGap16, | ||
| 41 | - Expanded( | ||
| 42 | - child: Text(_list[index]), | ||
| 43 | - ), | ||
| 44 | - LoadAssetImage(_selectValue.contains(index) ? 'shop/xz' : 'shop/xztm', width: 16.0, height: 16.0), | ||
| 45 | - Gaps.hGap16, | ||
| 46 | - ], | ||
| 47 | - ), | ||
| 48 | - ), | ||
| 49 | - onTap: () { | ||
| 50 | - if (mounted) { | ||
| 51 | - if (index == 0) { | ||
| 52 | - Toast.show('线上支付为必选项'); | ||
| 53 | - return; | ||
| 54 | - } | ||
| 55 | - setState(() { | ||
| 56 | - if (_selectValue.contains(index)) { | ||
| 57 | - _selectValue.remove(index); | ||
| 58 | - } else { | ||
| 59 | - _selectValue.add(index); | ||
| 60 | - } | ||
| 61 | - }); | ||
| 62 | - } | ||
| 63 | - }, | ||
| 64 | - ), | ||
| 65 | - ); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - @override | ||
| 69 | - Widget build(BuildContext context) { | ||
| 70 | - return BaseDialog( | ||
| 71 | - title: '支付方式(多选)', | ||
| 72 | - child: Column( | ||
| 73 | - mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
| 74 | - mainAxisSize: MainAxisSize.min, | ||
| 75 | - children: List.generate(_list.length, (i) => _buildItem(i)) | ||
| 76 | - ), | ||
| 77 | - onPressed: () { | ||
| 78 | - NavigatorUtils.goBack(context); | ||
| 79 | - widget.onPressed(_selectValue); | ||
| 80 | - }, | ||
| 81 | - ); | ||
| 82 | - } | ||
| 83 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter/services.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/util/input_formatter/number_text_input_formatter.dart'; | ||
| 5 | -import 'package:one_poem/util/theme_utils.dart'; | ||
| 6 | -import 'package:one_poem/util/toast_utils.dart'; | ||
| 7 | -import 'package:one_poem/widgets/base_dialog.dart'; | ||
| 8 | - | ||
| 9 | -/// design/7店铺-店铺配置/index.html#artboard3 | ||
| 10 | -class PriceInputDialog extends StatefulWidget { | ||
| 11 | - | ||
| 12 | - const PriceInputDialog({ | ||
| 13 | - Key? key, | ||
| 14 | - this.title, | ||
| 15 | - this.inputMaxPrice = 100000, | ||
| 16 | - required this.onPressed, | ||
| 17 | - }) : super(key : key); | ||
| 18 | - | ||
| 19 | - final String? title; | ||
| 20 | - final double inputMaxPrice; | ||
| 21 | - final Function(String) onPressed; | ||
| 22 | - | ||
| 23 | - @override | ||
| 24 | - _PriceInputDialog createState() => _PriceInputDialog(); | ||
| 25 | - | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -class _PriceInputDialog extends State<PriceInputDialog> { | ||
| 29 | - | ||
| 30 | - final TextEditingController _controller = TextEditingController(); | ||
| 31 | - | ||
| 32 | - @override | ||
| 33 | - void dispose() { | ||
| 34 | - _controller.dispose(); | ||
| 35 | - super.dispose(); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @override | ||
| 39 | - Widget build(BuildContext context) { | ||
| 40 | - return BaseDialog( | ||
| 41 | - title: widget.title, | ||
| 42 | - child: Container( | ||
| 43 | - height: 34.0, | ||
| 44 | - alignment: Alignment.center, | ||
| 45 | - margin: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 0.0), | ||
| 46 | - decoration: BoxDecoration( | ||
| 47 | - color: ThemeUtils.getDialogTextFieldColor(context), | ||
| 48 | - borderRadius: BorderRadius.circular(2.0), | ||
| 49 | - ), | ||
| 50 | - child: TextField( | ||
| 51 | - key: const Key('price_input'), | ||
| 52 | - autofocus: true, | ||
| 53 | - controller: _controller, | ||
| 54 | - //style: TextStyles.textDark14, | ||
| 55 | - keyboardType: const TextInputType.numberWithOptions(decimal: true), | ||
| 56 | - // 金额限制数字格式 | ||
| 57 | - inputFormatters: [UsNumberTextInputFormatter(max: widget.inputMaxPrice)], | ||
| 58 | - decoration: InputDecoration( | ||
| 59 | - isDense: true, | ||
| 60 | - contentPadding: const EdgeInsets.symmetric(horizontal: 16.0), | ||
| 61 | - border: InputBorder.none, | ||
| 62 | - hintText: '输入${widget.title}', | ||
| 63 | - //hintStyle: TextStyles.textGrayC14, | ||
| 64 | - ), | ||
| 65 | - ), | ||
| 66 | - ), | ||
| 67 | - onPressed: () { | ||
| 68 | - if (_controller.text.isEmpty) { | ||
| 69 | - Toast.show('请输入${widget.title}'); | ||
| 70 | - return; | ||
| 71 | - } | ||
| 72 | - NavigatorUtils.goBack(context); | ||
| 73 | - widget.onPressed(_controller.text); | ||
| 74 | - }, | ||
| 75 | - ); | ||
| 76 | - } | ||
| 77 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter/services.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/util/input_formatter/number_text_input_formatter.dart'; | ||
| 5 | -import 'package:one_poem/util/theme_utils.dart'; | ||
| 6 | -import 'package:one_poem/util/toast_utils.dart'; | ||
| 7 | -import 'package:one_poem/widgets/base_dialog.dart'; | ||
| 8 | - | ||
| 9 | -/// design/7店铺-店铺配置/index.html#artboard1 | ||
| 10 | -class RangePriceInputDialog extends StatefulWidget { | ||
| 11 | - | ||
| 12 | - const RangePriceInputDialog({ | ||
| 13 | - Key? key, | ||
| 14 | - this.title, | ||
| 15 | - required this.onPressed, | ||
| 16 | - }) : super(key : key); | ||
| 17 | - | ||
| 18 | - final String? title; | ||
| 19 | - final Function(String, String) onPressed; | ||
| 20 | - | ||
| 21 | - @override | ||
| 22 | - _RangePriceInputDialog createState() => _RangePriceInputDialog(); | ||
| 23 | - | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | -class _RangePriceInputDialog extends State<RangePriceInputDialog> { | ||
| 27 | - | ||
| 28 | - final TextEditingController _controller = TextEditingController(); | ||
| 29 | - final TextEditingController _controller1 = TextEditingController(); | ||
| 30 | - | ||
| 31 | - @override | ||
| 32 | - void dispose() { | ||
| 33 | - _controller.dispose(); | ||
| 34 | - _controller1.dispose(); | ||
| 35 | - super.dispose(); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @override | ||
| 39 | - Widget build(BuildContext context) { | ||
| 40 | - return BaseDialog( | ||
| 41 | - title: widget.title, | ||
| 42 | - child: Container( | ||
| 43 | - height: 34.0, | ||
| 44 | - margin: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 0.0), | ||
| 45 | - decoration: BoxDecoration( | ||
| 46 | - color: ThemeUtils.getDialogTextFieldColor(context), | ||
| 47 | - borderRadius: BorderRadius.circular(2.0), | ||
| 48 | - ), | ||
| 49 | - child: Row( | ||
| 50 | - children: <Widget>[ | ||
| 51 | - Expanded( | ||
| 52 | - child: _buildTextField(_controller), | ||
| 53 | - ), | ||
| 54 | - Container( | ||
| 55 | - alignment: Alignment.center, | ||
| 56 | - padding: const EdgeInsets.symmetric(horizontal: 12.0), | ||
| 57 | - color: context.dialogBackgroundColor, | ||
| 58 | - height: double.infinity, | ||
| 59 | - child: const Text('至') | ||
| 60 | - ), | ||
| 61 | - Expanded( | ||
| 62 | - child: _buildTextField(_controller1), | ||
| 63 | - ), | ||
| 64 | - ], | ||
| 65 | - ), | ||
| 66 | - ), | ||
| 67 | - onPressed: () { | ||
| 68 | - if (_controller.text.isEmpty || _controller1.text.isEmpty) { | ||
| 69 | - Toast.show('请输入${widget.title}'); | ||
| 70 | - return; | ||
| 71 | - } | ||
| 72 | - if (double.parse(_controller.text) >= double.parse(_controller1.text)) { | ||
| 73 | - Toast.show('最小金额不能大于最大金额!'); | ||
| 74 | - return; | ||
| 75 | - } | ||
| 76 | - NavigatorUtils.goBack(context); | ||
| 77 | - widget.onPressed(_controller.text, _controller1.text); | ||
| 78 | - }, | ||
| 79 | - ); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - Widget _buildTextField(TextEditingController controller) { | ||
| 83 | - return TextField( | ||
| 84 | - autofocus: true, | ||
| 85 | - //style: TextStyles.textDark14, | ||
| 86 | - controller: controller, | ||
| 87 | - keyboardType: const TextInputType.numberWithOptions(decimal: true), | ||
| 88 | - // 金额限制数字格式 | ||
| 89 | - inputFormatters: [UsNumberTextInputFormatter()], | ||
| 90 | - decoration: const InputDecoration( | ||
| 91 | - isDense: true, | ||
| 92 | - contentPadding: EdgeInsets.symmetric(horizontal: 16.0), | ||
| 93 | - border: InputBorder.none, | ||
| 94 | - //hintStyle: TextStyles.textGray14, | ||
| 95 | - ), | ||
| 96 | - ); | ||
| 97 | - } | ||
| 98 | -} |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_poem/res/resources.dart'; | ||
| 3 | -import 'package:one_poem/routers/fluro_navigator.dart'; | ||
| 4 | -import 'package:one_poem/widgets/base_dialog.dart'; | ||
| 5 | -import 'package:one_poem/widgets/load_image.dart'; | ||
| 6 | - | ||
| 7 | -/// design/7店铺-店铺配置/index.html#artboard9 | ||
| 8 | -class SendTypeDialog extends StatefulWidget { | ||
| 9 | - | ||
| 10 | - const SendTypeDialog({ | ||
| 11 | - Key? key, | ||
| 12 | - required this.onPressed, | ||
| 13 | - }) : super(key : key); | ||
| 14 | - | ||
| 15 | - final Function(int, String) onPressed; | ||
| 16 | - | ||
| 17 | - @override | ||
| 18 | - _SendTypeDialog createState() => _SendTypeDialog(); | ||
| 19 | -} | ||
| 20 | - | ||
| 21 | -class _SendTypeDialog extends State<SendTypeDialog> { | ||
| 22 | - | ||
| 23 | - int _value = 0; | ||
| 24 | - final _list = ['运费满免配置', '运费比例配置']; | ||
| 25 | - | ||
| 26 | - Widget _buildItem(int index) { | ||
| 27 | - return Material( | ||
| 28 | - type: MaterialType.transparency, | ||
| 29 | - child: InkWell( | ||
| 30 | - child: SizedBox( | ||
| 31 | - height: 42.0, | ||
| 32 | - child: Row( | ||
| 33 | - children: <Widget>[ | ||
| 34 | - Gaps.hGap16, | ||
| 35 | - Expanded( | ||
| 36 | - child: Text( | ||
| 37 | - _list[index], | ||
| 38 | - style: _value == index ? TextStyle( | ||
| 39 | - fontSize: Dimens.font_sp14, | ||
| 40 | - color: Theme.of(context).primaryColor, | ||
| 41 | - ) : null, | ||
| 42 | - ), | ||
| 43 | - ), | ||
| 44 | - Visibility( | ||
| 45 | - visible: _value == index, | ||
| 46 | - child: const LoadAssetImage('poem/ic_check', width: 16.0, height: 16.0)), | ||
| 47 | - Gaps.hGap16, | ||
| 48 | - ], | ||
| 49 | - ), | ||
| 50 | - ), | ||
| 51 | - onTap: () { | ||
| 52 | - if (mounted) { | ||
| 53 | - setState(() { | ||
| 54 | - _value = index; | ||
| 55 | - }); | ||
| 56 | - } | ||
| 57 | - }, | ||
| 58 | - ), | ||
| 59 | - ); | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - @override | ||
| 63 | - Widget build(BuildContext context) { | ||
| 64 | - return BaseDialog( | ||
| 65 | - title: '运费配置', | ||
| 66 | - child: Column( | ||
| 67 | - mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
| 68 | - mainAxisSize: MainAxisSize.min, | ||
| 69 | - children: List.generate(_list.length, (i) => _buildItem(i)) | ||
| 70 | - ), | ||
| 71 | - onPressed: () { | ||
| 72 | - NavigatorUtils.goBack(context); | ||
| 73 | - widget.onPressed(_value, _list[_value]); | ||
| 74 | - }, | ||
| 75 | - ); | ||
| 76 | - } | ||
| 77 | -} |
| ... | @@ -167,9 +167,6 @@ flutter: | ... | @@ -167,9 +167,6 @@ flutter: |
| 167 | - assets/images/login/ | 167 | - assets/images/login/ |
| 168 | - assets/images/account/ | 168 | - assets/images/account/ |
| 169 | - assets/images/state/ | 169 | - assets/images/state/ |
| 170 | - - assets/images/store/ | ||
| 171 | - - assets/images/shop/ | ||
| 172 | - - assets/images/poem/ | ||
| 173 | - assets/images/poem/ | 170 | - assets/images/poem/ |
| 174 | - assets/data/Data.json | 171 | - assets/data/Data.json |
| 175 | - assets/data/friends/ | 172 | - assets/data/friends/ | ... | ... |
-
Please register or login to post a comment