reason

clear

Showing 45 changed files with 0 additions and 1443 deletions
......@@ -7,7 +7,6 @@ import 'package:one_poem/home/webview_page.dart';
import 'package:one_poem/login/login_router.dart';
import 'package:one_poem/poem/poem_router.dart';
import 'package:one_poem/setting/setting_router.dart';
import 'package:one_poem/shop/shop_router.dart';
import 'i_router.dart';
import 'not_found_page.dart';
......@@ -40,7 +39,6 @@ class Routes {
_listRouter.clear();
/// 各自路由由各自模块管理,统一在此添加初始化
_listRouter.add(ShopRouter());
_listRouter.add(LoginRouter());
_listRouter.add(TimelineRouter());
_listRouter.add(PoemRouter());
......
import 'package:one_poem/account/models/user_entity.dart';
import 'package:one_poem/mvp/mvps.dart';
abstract class ShopIMvpView implements IMvpView {
void setUser(UserEntity? user);
bool get isAccessibilityTest;
}
class FreightConfigModel {
FreightConfigModel(this.min, this.max, this.type,
this.isAdd, this.price);
FreightConfigModel.fromJsonMap(Map<String, dynamic> map):
min = map['min'] as String,
max = map['max'] as String,
type = map['type'] as int,
isAdd = map['isAdd'] as bool,
price = map['price'] as String;
String min;
String max;
int type;
bool isAdd;
String price;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['min'] = min;
data['max'] = max;
data['type'] = type;
data['isAdd'] = isAdd;
data['price'] = price;
return data;
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/shop/models/freight_config_model.dart';
import 'package:one_poem/shop/widgets/price_input_dialog.dart';
import 'package:one_poem/shop/widgets/range_price_input_dialog.dart';
import 'package:one_poem/util/theme_utils.dart';
import 'package:one_poem/util/toast_utils.dart';
import 'package:one_poem/widgets/load_image.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
import 'package:one_poem/widgets/my_button.dart';
import 'package:one_poem/widgets/my_card.dart';
/// design/7店铺-店铺配置/index.html
class FreightConfigPage extends StatefulWidget {
const FreightConfigPage({Key? key}) : super(key: key);
@override
_FreightConfigPageState createState() => _FreightConfigPageState();
}
class _FreightConfigPageState extends State<FreightConfigPage> {
final List<FreightConfigModel> _list = [];
@override
void initState() {
super.initState();
_reset();
}
void _reset() {
_list.clear();
_list.add(FreightConfigModel('0', '', 1, false, ''));
_list.add(FreightConfigModel('', '', 1, true, ''));
_list.add(FreightConfigModel('', '-1', 1, false, ''));
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: '运费比例配置',
actionName: '重置',
onPressed: () {
setState(() {
_reset();
});
},
),
body: SafeArea(
child: Stack(
children: <Widget>[
Positioned(
left: 16.0,
right: 16.0,
bottom: 8.0,
child: MyButton(
onPressed: () {
NavigatorUtils.goBack(context);
},
text: '完成',
),
),
Positioned(
top: 0.0,
left: 0.0,
right: 0.0,
bottom: 64.0,
child: ListView.builder(
itemExtent: 114.0,
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
itemBuilder: (_, index) => _buildItem(index),
itemCount: _list.length,
),
),
],
),
),
);
}
// 暂时没有对输入数据进行校验
Widget _buildItem(int index) {
return _list[index].isAdd ?
Semantics(
label: '添加区间',
child: GestureDetector(
onTap: () {
final FreightConfigModel config = _list[index - 1];
if (config.max.isNotEmpty && config.min.isNotEmpty) {
setState(() {
_list.insert(_list.length - 2, FreightConfigModel('', '', 1, false, ''));
});
} else {
Toast.show('请先完善上一个区间金额!');
return;
}
},
child: Container(
key: const Key('add'),
margin: const EdgeInsets.only(bottom: 8.0),
padding: const EdgeInsets.symmetric(vertical: 32.0),
decoration: BoxDecoration(
color: context.isDark ? Colours.dark_bg_gray : Colours.bg_gray,
borderRadius: BorderRadius.circular(8.0),
),
child: const LoadAssetImage('shop/tj',),
),
),
) :
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: MyCard(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Text(index == 0 ? '订单金额小于' : (index == _list.length - 1 ? '订单金额不小于' : '订单金额区间')),
Expanded(
child: Semantics(
label: '填写订单金额',
child: InkWell(
onTap: () {
if (index == 0 || index == _list.length - 1) {
_showOrderPriceInputDialog(index);
} else {
_showRangePriceInputDialog(index);
}
},
child: Text(
_getPriceText(index).isEmpty ? '订单金额' : _getPriceText(index),
key: Key('订单金额$index'),
textAlign: TextAlign.end,
style: _getPriceText(index).isEmpty ? Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14) : null,
),
),
)),
Gaps.hGap5,
const Text('元'),
],
),
Gaps.vGap15,
Gaps.line,
Gaps.vGap15,
Row(
children: <Widget>[
Semantics(
label: '选择比率',
child: InkWell(
onTap: () {
setState(() {
_list[index].type = 1;
});
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LoadAssetImage(_list[index].type == 1 ? 'shop/xzyf' : 'shop/wxzyf', width: 16.0,),
Gaps.hGap4,
const Text('比率'),
],
),
),
),
Gaps.hGap16,
Semantics(
label: '选择金额',
child: InkWell(
onTap: () {
setState(() {
_list[index].type = 0;
});
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LoadAssetImage(_list[index].type == 0 ? 'shop/xzyf' : 'shop/wxzyf', width: 16.0),
Gaps.hGap4,
const Text('金额'),
],
),
),
),
Expanded(
child: Semantics(
label: '填写${_list[index].type == 1 ? '运费比率' : '运费金额'}',
child: InkWell(
onTap: () => _showFreightInputDialog(index),
child: Text(
_list[index].price.isEmpty ? (_list[index].type == 1 ? '运费比率' : '运费金额'): _list[index].price,
textAlign: TextAlign.end,
style: _list[index].price.isEmpty ? Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14) : null,
),
),
)),
Gaps.hGap5,
Text(_list[index].type == 1 ? '%' : '元'),
],
)
],
),
),
),
);
}
void _showOrderPriceInputDialog(int index) {
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PriceInputDialog(
title: '订单金额',
onPressed: (value) {
setState(() {
if (index == 0) {
_list[index].max = value;
} else {
_list[index].min = value;
}
});
},
);
}
);
}
void _showRangePriceInputDialog(int index) {
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return RangePriceInputDialog(
title: '订单金额',
onPressed: (min, max) {
setState(() {
_list[index].min = min;
_list[index].max = max;
});
},
);
}
);
}
void _showFreightInputDialog(int index) {
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PriceInputDialog(
title: _list[index].type == 1 ? '运费比率' : '运费金额',
inputMaxPrice: _list[index].type == 1 ? 100 : 100000,
onPressed: (value) {
setState(() {
_list[index].price = value;
});
},
);
}
);
}
String _getPriceText(int index) {
if (index == 0) {
if (_list[index].max.isEmpty) {
return '';
} else {
return _list[index].max;
}
} else if (index == _list.length - 1) {
if (_list[index].min.isEmpty) {
return '';
} else {
return _list[index].min;
}
} else {
if (_list[index].min.isEmpty || _list[index].max.isEmpty) {
return '';
} else {
return '${_list[index].min}~${_list[index].max}';
}
}
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
/// design/7店铺-店铺配置/index.html#artboard13
class InputTextPage extends StatefulWidget {
const InputTextPage({
Key? key,
required this.title,
this.content,
this.hintText,
this.keyboardType = TextInputType.text,
}) : super(key : key);
final String title;
final String? content;
final String? hintText;
final TextInputType? keyboardType;
@override
_InputTextPageState createState() => _InputTextPageState();
}
class _InputTextPageState extends State<InputTextPage> {
final TextEditingController _controller = TextEditingController();
List<TextInputFormatter>? _inputFormatters;
late int _maxLength;
@override
void initState() {
super.initState();
_controller.text = widget.content ?? '';
_maxLength = widget.keyboardType == TextInputType.phone ? 11 : 30;
_inputFormatters = widget.keyboardType == TextInputType.phone ? [FilteringTextInputFormatter.allow(RegExp('[0-9]'))] : null;
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
title: widget.title,
actionName: '完成',
onPressed: () {
NavigatorUtils.goBackWithParams(context, _controller.text);
},
),
body: Padding(
padding: const EdgeInsets.only(top: 21.0, left: 16.0, right: 16.0, bottom: 16.0),
child: Semantics(
multiline: true,
maxValueLength: _maxLength,
child: TextField(
maxLength: _maxLength,
maxLines: 5,
autofocus: true,
controller: _controller,
keyboardType: widget.keyboardType,
inputFormatters: _inputFormatters,
decoration: InputDecoration(
hintText: widget.hintText,
border: InputBorder.none,
),
),
),
),
);
}
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
import 'package:one_poem/widgets/my_card.dart';
/// design/8设置/index.html#artboard2
class MessagePage extends StatefulWidget {
const MessagePage({Key? key}) : super(key: key);
@override
_MessagePageState createState() => _MessagePageState();
}
class _MessagePageState extends State<MessagePage> {
final ScrollController _scrollController = ScrollController();
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
centerTitle: '消息',
actionName: '全部已读',
onPressed: () {},
),
body: Scrollbar( // 加个滚动条
controller: _scrollController,
child: ListView.builder(
itemCount: 20,
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 28.0),
itemBuilder: (_, __) => _MessageItem(),
),
),
);
}
}
class _MessageItem extends StatefulWidget {
@override
_MessageItemState createState() => _MessageItemState();
}
class _MessageItemState extends State<_MessageItem> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Gaps.vGap15,
Text('2021-5-31 17:19:36', style: Theme.of(context).textTheme.subtitle2),
Gaps.vGap8,
MyCard(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
const Expanded(child: Text('系统通知')),
Container(
margin: const EdgeInsets.only(right: 4.0),
height: 8.0,
width: 8.0,
decoration: BoxDecoration(
color: Colours.app_main,
borderRadius: BorderRadius.circular(4.0),
),
),
Images.arrowRight,
],
),
Gaps.vGap8,
Gaps.line,
Gaps.vGap8,
const Text('供货商由于[商品缺货]原因,取消了采购订单。', style: TextStyles.textSize12),
],
),
),
)
],
);
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/account/account_router.dart';
import 'package:one_poem/account/models/user_entity.dart';
import 'package:one_poem/mvp/base_page.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/setting/setting_router.dart';
import 'package:one_poem/shop/iview/shop_iview.dart';
import 'package:one_poem/shop/presenter/shop_presenter.dart';
import 'package:one_poem/shop/provider/user_provider.dart';
import 'package:one_poem/util/image_utils.dart';
import 'package:one_poem/util/theme_utils.dart';
import 'package:one_poem/widgets/load_image.dart';
import 'package:provider/provider.dart';
import '../shop_router.dart';
/// design/6店铺-账户/index.html#artboard0
class ShopPage extends StatefulWidget {
const ShopPage({
Key? key,
this.isAccessibilityTest = false,
}) : super(key : key);
final bool isAccessibilityTest;
@override
_ShopPageState createState() => _ShopPageState();
}
class _ShopPageState extends State<ShopPage> with BasePageMixin<ShopPage, ShopPagePresenter>, AutomaticKeepAliveClientMixin<ShopPage> implements ShopIMvpView {
final List<String> _menuTitle = ['账户流水', '资金管理', '提现账号'];
final List<String> _menuImage = ['zhls', 'zjgl', 'txzh'];
final List<String> _menuDarkImage = ['dark_zhls', 'dark_zjgl', 'dark_txzh'];
UserProvider provider = UserProvider();
@override
void setUser(UserEntity? user) {
provider.setUser(user);
}
@override
bool get isAccessibilityTest => widget.isAccessibilityTest;
@override
Widget build(BuildContext context) {
super.build(context);
final Color? _iconColor = ThemeUtils.getIconColor(context);
final Widget line = Container(
height: 0.6,
width: double.infinity,
margin: const EdgeInsets.only(left: 16.0),
child: Gaps.line,
);
return ChangeNotifierProvider<UserProvider>(
create: (_) => provider,
child: Scaffold(
appBar: AppBar(
actions: <Widget>[
IconButton(
tooltip: '消息',
onPressed: () {
NavigatorUtils.push(context, ShopRouter.messagePage);
},
icon: LoadAssetImage(
'shop/message',
key: const Key('message'),
width: 24.0,
height: 24.0,
color: _iconColor,
),
),
IconButton(
tooltip: '设置',
onPressed: () {
NavigatorUtils.push(context, SettingRouter.settingPage);
},
icon: LoadAssetImage(
'shop/setting',
key: const Key('setting'),
width: 24.0,
height: 24.0,
color: _iconColor,
),
)
],
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Gaps.vGap12,
Consumer<UserProvider>(
builder: (_, provider, child) {
final Widget header = Stack(
children: <Widget>[
const SizedBox(width: double.infinity, height: 56.0),
const Text(
'官方直营店',
style: TextStyles.textBold24,
),
Positioned(
right: 0.0,
child: CircleAvatar(
radius: 28.0,
backgroundColor: Colors.transparent,
backgroundImage: ImageUtils.getImageProvider(provider.user?.avatar, holderImg: 'shop/tx'),
),
),
child!,
],
);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: MergeSemantics(
child: header,
),
);
},
child: Positioned(
top: 38.0,
left: 0.0,
child: Row(
children: const <Widget>[
LoadAssetImage('shop/zybq', width: 40.0, height: 16.0,),
Gaps.hGap8,
Text('店铺账号:15000000000', style: TextStyles.textSize12)
],
),
),
),
Gaps.vGap24,
line,
Gaps.vGap24,
const MergeSemantics(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'账户',
style: TextStyles.textBold18,
),
),
),
_ShopFunctionModule(
data: _menuTitle,
image: _menuImage,
darkImage: _menuDarkImage,
onItemClick: (index) {
if (index == 0) {
NavigatorUtils.push(context, AccountRouter.accountPage);
} else if (index == 1) {
NavigatorUtils.push(context, AccountRouter.accountPage);
} else if (index == 2) {
NavigatorUtils.push(context, AccountRouter.accountPage);
}
},
),
line,
Gaps.vGap24,
const MergeSemantics(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'店铺',
style: TextStyles.textBold18,
),
),
),
/// 使用Flexible防止溢出
Flexible(
child: _ShopFunctionModule(
data: const ['店铺设置'],
image: const ['dpsz'],
darkImage: const ['dark_dpsz'],
onItemClick: (index) {
NavigatorUtils.push(context, ShopRouter.shopSettingPage);
},
),
),
],
),
),
);
}
@override
bool get wantKeepAlive => true;
@override
ShopPagePresenter createPresenter() => ShopPagePresenter();
}
class _ShopFunctionModule extends StatelessWidget {
const _ShopFunctionModule({
Key? key,
required this.onItemClick,
required this.data,
required this.image,
required this.darkImage,
}): super(key: key);
final Function(int index) onItemClick;
final List<String> data;
final List<String> image;
final List<String> darkImage;
@override
Widget build(BuildContext context) {
return GridView.builder(
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 12.0),
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1.18,
),
itemCount: data.length,
itemBuilder: (_, index) {
return InkWell(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
LoadAssetImage(context.isDark ? 'shop/${darkImage[index]}' : 'shop/${image[index]}', width: 32.0),
Gaps.vGap4,
Text(
data[index],
style: TextStyles.textSize12,
)
],
),
onTap: () {
onItemClick(index);
},
);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/shop/widgets/pay_type_dialog.dart';
import 'package:one_poem/shop/widgets/price_input_dialog.dart';
import 'package:one_poem/shop/widgets/send_type_dialog.dart';
import 'package:one_poem/util/other_utils.dart';
import 'package:one_poem/widgets/click_item.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
import 'package:one_poem/widgets/my_button.dart';
import 'package:one_poem/widgets/my_scroll_view.dart';
import '../shop_router.dart';
/// design/7店铺-店铺配置/index.html#artboard17
class ShopSettingPage extends StatefulWidget {
const ShopSettingPage({Key? key}) : super(key: key);
@override
_ShopSettingPageState createState() => _ShopSettingPageState();
}
class _ShopSettingPageState extends State<ShopSettingPage> {
bool _check = false;
List<int> _selectValue = [0];
int _sendType = 0;
String _sendPrice = '0.00';
String _freePrice = '0.00';
String _phone = '';
String _shopIntroduction = '零食铺子坚果饮料美酒佳肴…';
String _securityService = '假一赔十';
String _address = '陕西省 西安市 长安区 郭杜镇郭北村韩林路圣方医院斜对面';
@override
Widget build(BuildContext context) {
return Scaffold(
// 防止键盘弹出,提交按钮升起。。。
resizeToAvoidBottomInset: false,
appBar: const MyAppBar(),
body: MyScrollView(
padding: const EdgeInsets.symmetric(vertical: 16.0),
bottomButton: Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 8.0),
child: MyButton(
text: '提交',
onPressed: () => NavigatorUtils.goBack(context),
),
),
children: <Widget>[
Gaps.vGap5,
Row(
children: <Widget>[
Gaps.hGap16,
Text(
_check ? '正在营业' : '暂停营业',
style: TextStyles.textBold24,
),
const Spacer(),
Semantics(
label: '店铺营业开关',
child: Switch.adaptive(
value: _check,
onChanged: (bool val) {
setState(() {
_check = val;
});
},
),
),
Gaps.hGap4,
],
),
Gaps.vGap32,
const Padding(
padding: EdgeInsets.only(left: 16.0),
child: Text('基础设置', style: TextStyles.textBold18),
),
Gaps.vGap16,
ClickItem(
title: '店铺简介',
content: _shopIntroduction,
onTap: () {
_goInputTextPage(context, '店铺简介', '这里有一段完美的简介…', _shopIntroduction, (result) {
setState(() {
_shopIntroduction = result.toString();
});
},);
},
),
ClickItem(
title: '保障服务',
content: _securityService,
onTap: () {
_goInputTextPage(context, '保障服务', '这里有一段完美的说明…', _securityService, (result) {
setState(() {
_securityService = result.toString();
});
},);
},
),
ClickItem(
title: '支付方式',
content: _getPayType(),
onTap: _showPayTypeDialog,
),
Gaps.vGap32,
const Padding(
padding: EdgeInsets.only(left: 16.0),
child: Text('运费设置', style: TextStyles.textBold18),
),
Gaps.vGap16,
ClickItem(
title: '运费配置',
content: _sendType == 0 ? '运费满免配置' : '运费比例配置',
onTap: _showSendTypeDialog,
),
Visibility(
visible: _sendType != 1,
child: ClickItem(
title: '运费满免',
content: _freePrice,
onTap: () {
_showInputDialog('配送费满免', (value) {
setState(() {
_freePrice = value;
});
});
},
),
),
Visibility(
visible: _sendType != 1,
child: ClickItem(
title: '配送费用',
content: _sendPrice,
onTap: () {
_showInputDialog('配送费用', (value) {
setState(() {
_sendPrice = value;
});
});
},
),
),
Visibility(
visible: _sendType != 0,
child: ClickItem(
maxLines: 10,
title: '运费比例',
content: '1、订单金额<20元,配送费为订单金额的1%\n2、订单金额≥20元,配送费为订单金额的1%',
onTap: () => NavigatorUtils.push(context, ShopRouter.freightConfigPage),
),
),
Gaps.vGap32,
const Padding(
padding: EdgeInsets.only(left: 16.0),
child: Text('联系信息', style: TextStyles.textBold18,),
),
Gaps.vGap16,
ClickItem(
title: '联系电话',
content: _phone,
onTap: () {
_goInputTextPage(context, '联系电话', '这里有一串神秘的数字…', _phone, (result) {
setState(() {
_phone = result.toString();
});
}, keyboardType: TextInputType.phone,);
},
),
ClickItem(
maxLines: 2,
title: '店铺地址',
content: _address,
onTap: () {
// NavigatorUtils.pushResult(context, ShopRouter.addressSelectPage, (result) {
// setState(() {
// final PoiSearch model = result as PoiSearch;
// _address = '${model.provinceName.nullSafe} ${model.cityName.nullSafe} ${model.adName.nullSafe} ${model.title.nullSafe}';
// });
// });
},
),
Gaps.vGap8,
],
)
);
}
String _getPayType() {
String payType = '';
for (final int s in _selectValue) {
if (s == 0) {
payType = '$payType在线支付+';
} else if (s == 1) {
payType = '$payType对公转账+';
} else if (s == 2) {
payType = '$payType货到付款+';
}
}
return payType.substring(0, payType.length - 1);
}
void _goInputTextPage(BuildContext context, String title,
String hintText, String content, Function(Object?) function,
{TextInputType? keyboardType}) {
NavigatorUtils.pushResult(context,
ShopRouter.inputTextPage, function,
arguments: InputTextPageArgumentsData(
title: title,
hintText: hintText,
content: content,
keyboardType: keyboardType,
)
);
}
void _showInputDialog(String title, Function(String) onPressed) {
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PriceInputDialog(
title: title,
onPressed: onPressed,
);
},
);
}
void _showPayTypeDialog() {
showElasticDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PayTypeDialog(
value: _selectValue,
onPressed: (value) {
setState(() {
_selectValue = value.cast<int>();
});
},
);
},
);
}
void _showSendTypeDialog() {
showElasticDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return SendTypeDialog(
onPressed: (i, value) {
setState(() {
_sendType = i;
});
},
);
},
);
}
}
class InputTextPageArgumentsData {
InputTextPageArgumentsData({
required this.title,
this.content,
this.hintText,
this.keyboardType,
});
late String title;
late String? content;
late String? hintText;
late TextInputType? keyboardType;
}
import 'package:flutter/material.dart';
import 'package:one_poem/account/models/user_entity.dart';
import 'package:one_poem/mvp/base_page_presenter.dart';
import 'package:one_poem/net/dio_utils.dart';
import 'package:one_poem/net/http_api.dart';
import 'package:one_poem/shop/iview/shop_iview.dart';
class ShopPagePresenter extends BasePagePresenter<ShopIMvpView> {
@override
void initState() {
WidgetsBinding.instance!.addPostFrameCallback((_) {
if (view.isAccessibilityTest) {
return;
}
/// 接口请求例子
/// get请求参数queryParameters post请求参数params
asyncRequestNetwork<UserEntity>(Method.get,
url: HttpApi.users,
onSuccess: (data) {
view.setUser(data);
},
);
});
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/account/models/user_entity.dart';
class UserProvider extends ChangeNotifier {
UserEntity? _user;
UserEntity? get user => _user;
void setUser(UserEntity? user) {
_user = user;
notifyListeners();
}
}
import 'package:fluro/fluro.dart';
import 'package:one_poem/routers/i_router.dart';
import 'page/freight_config_page.dart';
import 'page/input_text_page.dart';
import 'page/message_page.dart';
import 'page/shop_page.dart';
import 'page/shop_setting_page.dart';
class ShopRouter implements IRouterProvider{
static String shopPage = '/shop';
static String shopSettingPage = '/shop/shopSetting';
static String messagePage = '/shop/message';
static String freightConfigPage = '/shop/freightConfig';
static String addressSelectPage = '/shop/addressSelect';
static String inputTextPage = '/shop/inputText';
@override
void initRouter(FluroRouter router) {
router.define(shopPage, handler: Handler(handlerFunc: (_, __) => const ShopPage()));
router.define(shopSettingPage, handler: Handler(handlerFunc: (_, __) => const ShopSettingPage()));
router.define(messagePage, handler: Handler(handlerFunc: (_, __) => const MessagePage()));
router.define(freightConfigPage, handler: Handler(handlerFunc: (_, __) => const FreightConfigPage()));
router.define(inputTextPage, handler: Handler(handlerFunc: (context, params) {
/// 类参数
final args = context!.settings!.arguments! as InputTextPageArgumentsData;
return InputTextPage(
title: args.title,
hintText: args.hintText,
content: args.content,
keyboardType: args.keyboardType,
);
}));
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/util/toast_utils.dart';
import 'package:one_poem/widgets/base_dialog.dart';
import 'package:one_poem/widgets/load_image.dart';
/// design/7店铺-店铺配置/index.html#artboard10
class PayTypeDialog extends StatefulWidget {
const PayTypeDialog({
Key? key,
this.value,
required this.onPressed,
}) : super(key : key);
final List<int>? value;
final Function(List<int>) onPressed;
@override
_PayTypeDialog createState() => _PayTypeDialog();
}
class _PayTypeDialog extends State<PayTypeDialog> {
late List<int> _selectValue;
final List<String> _list = <String>['线上支付', '对公转账', '货到付款'];
Widget _buildItem(int index) {
_selectValue = widget.value ?? <int>[0];
return Material(
type: MaterialType.transparency,
child: InkWell(
child: SizedBox(
height: 42.0,
child: Row(
children: <Widget>[
Gaps.hGap16,
Expanded(
child: Text(_list[index]),
),
LoadAssetImage(_selectValue.contains(index) ? 'shop/xz' : 'shop/xztm', width: 16.0, height: 16.0),
Gaps.hGap16,
],
),
),
onTap: () {
if (mounted) {
if (index == 0) {
Toast.show('线上支付为必选项');
return;
}
setState(() {
if (_selectValue.contains(index)) {
_selectValue.remove(index);
} else {
_selectValue.add(index);
}
});
}
},
),
);
}
@override
Widget build(BuildContext context) {
return BaseDialog(
title: '支付方式(多选)',
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
children: List.generate(_list.length, (i) => _buildItem(i))
),
onPressed: () {
NavigatorUtils.goBack(context);
widget.onPressed(_selectValue);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/util/input_formatter/number_text_input_formatter.dart';
import 'package:one_poem/util/theme_utils.dart';
import 'package:one_poem/util/toast_utils.dart';
import 'package:one_poem/widgets/base_dialog.dart';
/// design/7店铺-店铺配置/index.html#artboard3
class PriceInputDialog extends StatefulWidget {
const PriceInputDialog({
Key? key,
this.title,
this.inputMaxPrice = 100000,
required this.onPressed,
}) : super(key : key);
final String? title;
final double inputMaxPrice;
final Function(String) onPressed;
@override
_PriceInputDialog createState() => _PriceInputDialog();
}
class _PriceInputDialog extends State<PriceInputDialog> {
final TextEditingController _controller = TextEditingController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BaseDialog(
title: widget.title,
child: Container(
height: 34.0,
alignment: Alignment.center,
margin: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 0.0),
decoration: BoxDecoration(
color: ThemeUtils.getDialogTextFieldColor(context),
borderRadius: BorderRadius.circular(2.0),
),
child: TextField(
key: const Key('price_input'),
autofocus: true,
controller: _controller,
//style: TextStyles.textDark14,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
// 金额限制数字格式
inputFormatters: [UsNumberTextInputFormatter(max: widget.inputMaxPrice)],
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0),
border: InputBorder.none,
hintText: '输入${widget.title}',
//hintStyle: TextStyles.textGrayC14,
),
),
),
onPressed: () {
if (_controller.text.isEmpty) {
Toast.show('请输入${widget.title}');
return;
}
NavigatorUtils.goBack(context);
widget.onPressed(_controller.text);
},
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/util/input_formatter/number_text_input_formatter.dart';
import 'package:one_poem/util/theme_utils.dart';
import 'package:one_poem/util/toast_utils.dart';
import 'package:one_poem/widgets/base_dialog.dart';
/// design/7店铺-店铺配置/index.html#artboard1
class RangePriceInputDialog extends StatefulWidget {
const RangePriceInputDialog({
Key? key,
this.title,
required this.onPressed,
}) : super(key : key);
final String? title;
final Function(String, String) onPressed;
@override
_RangePriceInputDialog createState() => _RangePriceInputDialog();
}
class _RangePriceInputDialog extends State<RangePriceInputDialog> {
final TextEditingController _controller = TextEditingController();
final TextEditingController _controller1 = TextEditingController();
@override
void dispose() {
_controller.dispose();
_controller1.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BaseDialog(
title: widget.title,
child: Container(
height: 34.0,
margin: const EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 0.0),
decoration: BoxDecoration(
color: ThemeUtils.getDialogTextFieldColor(context),
borderRadius: BorderRadius.circular(2.0),
),
child: Row(
children: <Widget>[
Expanded(
child: _buildTextField(_controller),
),
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 12.0),
color: context.dialogBackgroundColor,
height: double.infinity,
child: const Text('至')
),
Expanded(
child: _buildTextField(_controller1),
),
],
),
),
onPressed: () {
if (_controller.text.isEmpty || _controller1.text.isEmpty) {
Toast.show('请输入${widget.title}');
return;
}
if (double.parse(_controller.text) >= double.parse(_controller1.text)) {
Toast.show('最小金额不能大于最大金额!');
return;
}
NavigatorUtils.goBack(context);
widget.onPressed(_controller.text, _controller1.text);
},
);
}
Widget _buildTextField(TextEditingController controller) {
return TextField(
autofocus: true,
//style: TextStyles.textDark14,
controller: controller,
keyboardType: const TextInputType.numberWithOptions(decimal: true),
// 金额限制数字格式
inputFormatters: [UsNumberTextInputFormatter()],
decoration: const InputDecoration(
isDense: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16.0),
border: InputBorder.none,
//hintStyle: TextStyles.textGray14,
),
);
}
}
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/widgets/base_dialog.dart';
import 'package:one_poem/widgets/load_image.dart';
/// design/7店铺-店铺配置/index.html#artboard9
class SendTypeDialog extends StatefulWidget {
const SendTypeDialog({
Key? key,
required this.onPressed,
}) : super(key : key);
final Function(int, String) onPressed;
@override
_SendTypeDialog createState() => _SendTypeDialog();
}
class _SendTypeDialog extends State<SendTypeDialog> {
int _value = 0;
final _list = ['运费满免配置', '运费比例配置'];
Widget _buildItem(int index) {
return Material(
type: MaterialType.transparency,
child: InkWell(
child: SizedBox(
height: 42.0,
child: Row(
children: <Widget>[
Gaps.hGap16,
Expanded(
child: Text(
_list[index],
style: _value == index ? TextStyle(
fontSize: Dimens.font_sp14,
color: Theme.of(context).primaryColor,
) : null,
),
),
Visibility(
visible: _value == index,
child: const LoadAssetImage('poem/ic_check', width: 16.0, height: 16.0)),
Gaps.hGap16,
],
),
),
onTap: () {
if (mounted) {
setState(() {
_value = index;
});
}
},
),
);
}
@override
Widget build(BuildContext context) {
return BaseDialog(
title: '运费配置',
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
children: List.generate(_list.length, (i) => _buildItem(i))
),
onPressed: () {
NavigatorUtils.goBack(context);
widget.onPressed(_value, _list[_value]);
},
);
}
}
......@@ -167,9 +167,6 @@ flutter:
- assets/images/login/
- assets/images/account/
- assets/images/state/
- assets/images/store/
- assets/images/shop/
- assets/images/poem/
- assets/images/poem/
- assets/data/Data.json
- assets/data/friends/
......