From c057797a475f2509c85462776c74b280305053ad Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Thu, 5 Nov 2020 14:26:13 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E7=9A=84=E5=A4=B4=E9=83=A8(=E7=BC=BA=E6=95=B0=E6=8D=AE)=202?= =?UTF-8?q?=E3=80=81=E7=83=AD=E6=A6=9C=E7=9A=84UI=E4=BC=98=E5=8C=96=203?= =?UTF-8?q?=E3=80=81=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E9=A2=86=E5=8F=96=204=E3=80=81=E6=88=91?= =?UTF-8?q?=E7=9A=84=E9=92=B1=E5=8C=85UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../favorites_page/bloc/favorites_bloc.dart | 4 +- .../favorites_page/bloc/favorites_event.dart | 6 +- .../bloc/favorites_repository.dart | 18 +- lib/pages/favorites_page/favorites_page.dart | 2 +- .../goods_details_page.dart | 167 +++++--- .../goods_details_appbar_color_notifier.dart | 12 + .../hot_ranking_page/hot_ranking_page.dart | 4 +- .../message_notice_page.dart | 3 +- .../vip_center_page/vip_center_page.dart | 10 +- lib/register.dart | 2 +- .../appbar/goods_details_appbar_widget.dart | 77 ++++ .../goods_details/coupon/counpon_widget.dart | 49 ++- .../coupon/model/counpon_model.dart | 35 +- .../footer/goods_details_footer_widget.dart | 7 +- .../goods_details/store/store_widget.dart | 19 +- .../hot_ranking_goods/hot_ranking_goods.dart | 138 ++---- .../hot_ranking/hot_tab_bar/hot_tab_bar.dart | 14 +- .../wallet/wallet_appbar/wallet_appbar.dart | 3 +- .../wallet/wallet_detail/wallet_detail.dart | 132 +++--- .../wallet_bil_detail/wallet_bil_detail.dart | 397 ++++++------------ 20 files changed, 534 insertions(+), 565 deletions(-) create mode 100644 lib/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart create mode 100644 lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart diff --git a/lib/pages/favorites_page/bloc/favorites_bloc.dart b/lib/pages/favorites_page/bloc/favorites_bloc.dart index dcae1c0..eec3548 100644 --- a/lib/pages/favorites_page/bloc/favorites_bloc.dart +++ b/lib/pages/favorites_page/bloc/favorites_bloc.dart @@ -35,11 +35,11 @@ class FavoritesBloc extends Bloc<FavoritesEvent, FavoritesState> { /// 初始化 Stream<FavoritesState> _mapInitEventToState(FavoritesInitEvent event) async* { - var cache = await repository.fetchCachedStyle(); + var cache = await repository.fetchCachedStyle(event?.model); if (!EmptyUtil.isEmpty(cache)) { yield FavoritesLoadedState(model: cache); } - var result = await repository.fetchNetStyle(); + var result = await repository.fetchNetStyle(event?.model); if (!EmptyUtil.isEmpty(result)) { yield FavoritesLoadedState(model: result); } else { diff --git a/lib/pages/favorites_page/bloc/favorites_event.dart b/lib/pages/favorites_page/bloc/favorites_event.dart index bd2f842..3ad11f0 100644 --- a/lib/pages/favorites_page/bloc/favorites_event.dart +++ b/lib/pages/favorites_page/bloc/favorites_event.dart @@ -4,4 +4,8 @@ part of 'favorites_bloc.dart'; abstract class FavoritesEvent {} /// 初始化数据 -class FavoritesInitEvent extends FavoritesEvent {} +class FavoritesInitEvent extends FavoritesEvent { + final Map<String, dynamic> model; + + FavoritesInitEvent({this.model}); +} diff --git a/lib/pages/favorites_page/bloc/favorites_repository.dart b/lib/pages/favorites_page/bloc/favorites_repository.dart index aca6d2c..fcf7ec0 100644 --- a/lib/pages/favorites_page/bloc/favorites_repository.dart +++ b/lib/pages/favorites_page/bloc/favorites_repository.dart @@ -6,12 +6,14 @@ import 'package:zhiying_comm/zhiying_comm.dart'; class FavoritesRepository { /// 请求网络样式 - Future<FavoritesStyleModel> fetchNetStyle() async { + Future<FavoritesStyleModel> fetchNetStyle(final Map<String, dynamic> data) async { try { - var result = await NetUtil.post('/api/v1/mod/pub.flutter.my_fav', cache: true, method: NetMethod.GET); + String skip_identifier = + !EmptyUtil.isEmpty(data) && data.containsKey('skip_identifier') && !EmptyUtil.isEmpty(data['skip_identifier']) ? data['skip_identifier'] : 'pub.flutter.my_fav'; + var result = await NetUtil.post('/api/v1/mod/$skip_identifier', cache: true, method: NetMethod.GET); if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { var modListData = result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list'][0]['data']; - if(!EmptyUtil.isEmpty(modListData)){ + if (!EmptyUtil.isEmpty(modListData)) { return FavoritesStyleModel.fromJson(jsonDecode(modListData)); } } @@ -22,12 +24,14 @@ class FavoritesRepository { } /// 获取缓存样式 - Future<FavoritesStyleModel> fetchCachedStyle() async { + Future<FavoritesStyleModel> fetchCachedStyle(final Map<String, dynamic> data) async { try { - var result = await NetUtil.getRequestCachedData('/api/v1/mod/pub.flutter.my_fav'); - if(!EmptyUtil.isEmpty(result)){ + String skip_identifier = + !EmptyUtil.isEmpty(data) && data.containsKey('skip_identifier') && !EmptyUtil.isEmpty(data['skip_identifier']) ? data['skip_identifier'] : 'pub.flutter.my_fav'; + var result = await NetUtil.getRequestCachedData('/api/v1/mod/$skip_identifier'); + if (!EmptyUtil.isEmpty(result)) { var modListData = result['mod_list'][0]['data']; - if(!EmptyUtil.isEmpty(modListData)){ + if (!EmptyUtil.isEmpty(modListData)) { return FavoritesStyleModel.fromJson(jsonDecode(modListData)); } } diff --git a/lib/pages/favorites_page/favorites_page.dart b/lib/pages/favorites_page/favorites_page.dart index 385dc00..448ac4c 100644 --- a/lib/pages/favorites_page/favorites_page.dart +++ b/lib/pages/favorites_page/favorites_page.dart @@ -30,7 +30,7 @@ class FavoritesPage extends StatelessWidget { ChangeNotifierProvider.value(value: FavoritesPageNotifier()), ], child: BlocProvider<FavoritesBloc>( - create: (_) => FavoritesBloc(FavoritesRepository())..add(FavoritesInitEvent()), + create: (_) => FavoritesBloc(FavoritesRepository())..add(FavoritesInitEvent(model: data)), child: _FavoritesPageContainer(), ), ); diff --git a/lib/pages/goods_details_page/goods_details_page.dart b/lib/pages/goods_details_page/goods_details_page.dart index 5f7354d..a5ba5a6 100644 --- a/lib/pages/goods_details_page/goods_details_page.dart +++ b/lib/pages/goods_details_page/goods_details_page.dart @@ -8,9 +8,12 @@ import 'package:zhiying_base_widget/pages/goods_details_page/bloc/goods_details_ import 'package:zhiying_base_widget/pages/goods_details_page/bloc/goods_details_page_repository.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page_sk.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/notifier/goods_details_page_notifier.dart'; +import 'package:zhiying_base_widget/widgets/goods_details/appbar/goods_details_appbar_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; +import 'notifier/goods_details_appbar_color_notifier.dart'; + class GoodsDetailsPage extends StatefulWidget { final Map<String, dynamic> data; @@ -33,10 +36,10 @@ class _GoodsDetailsPageState extends State<GoodsDetailsPage> { providers: [ /// 滑动通知 ChangeNotifierProvider.value(value: GoodsDetailsPageNotifier()), + ChangeNotifierProvider.value(value: GoodsDetailsAppBarColorNotifier()), ], child: BlocProvider<GoodsDetailsPageBloc>( - create: (_) => - GoodsDetailsPageBloc(repository: GoodsDetailsPageRepository())..add(GoodsDetailsPageInitEvent(model: widget?.data)), + create: (_) => GoodsDetailsPageBloc(repository: GoodsDetailsPageRepository())..add(GoodsDetailsPageInitEvent(model: widget?.data)), child: GoodsDetailsContainer(widget?.data), ), ); @@ -54,9 +57,9 @@ class GoodsDetailsContainer extends StatefulWidget { class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { bool _isEnded = false; - ScrollController _controller = ScrollController(); - RefreshController _refreshController = - RefreshController(initialRefresh: false); + ScrollController _controller; + RefreshController _refreshController; + final int BANNER_HEIGHT = 375 - 40; void _onLoading() async { // await Future.delayed(Duration(milliseconds: 1000)); @@ -71,60 +74,60 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { Navigator.maybePop(context); } - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - @override void initState() { + _refreshController = RefreshController(initialRefresh: false); + _controller = ScrollController(); _controller.addListener(() { // print('${_controller.offset} ${_controller.position.maxScrollExtent}'); - if (_controller.offset >= _controller.position.maxScrollExtent && - !_isEnded) { + if (_controller.offset >= _controller.position.maxScrollExtent && !_isEnded) { // 滑动到底部 _isEnded = true; - Provider.of<GoodsDetailsPageNotifier>(context, listen: false) - .loadMore(); - } else if (_controller.offset < _controller.position.maxScrollExtent && - _isEnded) { + Provider.of<GoodsDetailsPageNotifier>(context, listen: false).loadMore(); + } else if (_controller.offset < _controller.position.maxScrollExtent && _isEnded) { _isEnded = false; Provider.of<GoodsDetailsPageNotifier>(context, listen: false).reset(); } + + if (_controller.offset >= 0 && _controller.offset <= BANNER_HEIGHT) { + double percent = _controller.offset == 0 ? 0.0 : _controller.offset / BANNER_HEIGHT; + Provider.of<GoodsDetailsAppBarColorNotifier>(context, listen: false).setPercent(percent); + } else if (_controller.offset > BANNER_HEIGHT && _controller.offset <= BANNER_HEIGHT + 300) { + Provider.of<GoodsDetailsAppBarColorNotifier>(context, listen: false).setPercent(1); + } }); super.initState(); } + @override + void dispose() { + _controller?.dispose(); + _refreshController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { - return MediaQuery.removePadding( - removeTop: true, - context: context, - child: Container( - width: double.infinity, - child: BlocConsumer<GoodsDetailsPageBloc, GoodsDetailsPageState>( - listener: (BuildContext context, GoodsDetailsPageState state) { - if (state is GoodsDetailsPageErrorState) { - print('数据加载出错'); - } - }, - buildWhen: (previous, current) { - /// 数据加载出错不进行build - if (current is GoodsDetailsPageErrorState) { - return false; - } - return true; - }, - builder: (context, state) { - print('GoodsDetailsPage currente state = $state'); - if (state is GoodsDetailsPageLoadedState) { - return _getMainWidget(state?.model); - } - return GoodsDetailsPageSkeleton(); - }, - ), - ), + return BlocConsumer<GoodsDetailsPageBloc, GoodsDetailsPageState>( + listener: (BuildContext context, GoodsDetailsPageState state) { + if (state is GoodsDetailsPageErrorState) { + print('数据加载出错'); + } + }, + buildWhen: (previous, current) { + /// 数据加载出错不进行build + if (current is GoodsDetailsPageErrorState) { + return false; + } + return true; + }, + builder: (context, state) { + print('GoodsDetailsPage currente state = $state'); + if (state is GoodsDetailsPageLoadedState) { + return _getMainWidget(state?.model); + } + return GoodsDetailsPageSkeleton(); + }, ); } @@ -140,27 +143,21 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { controller: _controller, slivers: _createContent(context, datas ?? []), ), - _getAppBarWidget(), + Align(alignment: Alignment.topCenter, child: GoodsDetailsAppBarWidget()), ], )), - /// appBar - // Align(alignment: Alignment.topCenter, child: _getAppBarWidget()), - /// 底部 - bottomNavigationBar: GoodsDetailsFooterWidget( - !EmptyUtil.isEmpty(datas) ? datas[datas.length - 1] : null), + bottomNavigationBar: GoodsDetailsFooterWidget(!EmptyUtil.isEmpty(datas) ? datas[datas.length - 1] : null), ); } - List<Widget> _createContent( - BuildContext context, List<Map<String, dynamic>> datas) { + List<Widget> _createContent(BuildContext context, List<Map<String, dynamic>> datas) { List<Widget> list = List(); /// datas.length - 1 为最后一个在底部 for (int i = 0; i < datas.length - 1; i++) { - WidgetModel item = - WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); + WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); print('item.modName ${item.modName}'); list.addAll(WidgetFactory.create( @@ -186,21 +183,57 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { Widget _getAppBarWidget() { return Container( width: double.infinity, - height: 40, - margin: - EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top), - child: AppBar( - backgroundColor: Colors.transparent, - elevation: 0, - leading: IconButton( - icon: Icon( - Icons.arrow_back_ios, - size: 22, - color: HexColor.fromHex('#FFFFFF'), + color: HexColor.fromHex('#FF4242'), + height: MediaQueryData.fromWindow(window).padding.top + 44, + padding: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: <Widget>[ + Padding( + padding: const EdgeInsets.only(left: 12.5), + child: SizedBox( + width: 40, + height: 40, + child: IconButton( + icon: Icon( + Icons.arrow_back_ios, + size: 22, + color: HexColor.fromHex('#FFFFFF'), + ), + onPressed: () => _openPop(), + ), + )), + Text( + '商品详情', + style: TextStyle(color: HexColor.fromHex('#FFFFFF'), fontSize: 15, fontWeight: FontWeight.bold), ), - onPressed: () => _openPop(), - ), + Padding( + padding: const EdgeInsets.only(right: 12.5), + child: SizedBox( + width: 40, + height: 40, + child: Container( + height: double.infinity, + width: double.infinity, + color: Colors.transparent, + ), + )), + ], ), + // child: AppBar( + // backgroundColor: Colors.transparent, + // elevation: 0, + // leading: + // IconButton( + // icon: Icon( + // Icons.arrow_back_ios, + // size: 22, + // color: HexColor.fromHex('#FFFFFF'), + // ), + // onPressed: () => _openPop(), + // ), + // ), ); } } diff --git a/lib/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart b/lib/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart new file mode 100644 index 0000000..d1ecd51 --- /dev/null +++ b/lib/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class GoodsDetailsAppBarColorNotifier with ChangeNotifier { + double percent = 0.0; + + void setPercent(double value) { + if (percent != value) { + this.percent = value; + notifyListeners(); + } + } +} diff --git a/lib/pages/hot_ranking_page/hot_ranking_page.dart b/lib/pages/hot_ranking_page/hot_ranking_page.dart index 390d904..85b17b2 100644 --- a/lib/pages/hot_ranking_page/hot_ranking_page.dart +++ b/lib/pages/hot_ranking_page/hot_ranking_page.dart @@ -9,6 +9,7 @@ import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifi import 'package:zhiying_base_widget/utils/contants.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; +import 'dart:ui'; import 'hot_ranking_page_bloc.dart'; @@ -96,7 +97,8 @@ class __HotRankingPageContainerState extends State<_HotRankingPageContainer> { return Stack( children: <Widget>[ Container( - height: 293.h, + height: 146.74 + MediaQueryData.fromWindow(window).padding.top, + width: double.infinity, child: CachedNetworkImage( imageUrl: _bloc.backgroundImage ?? "", fit: BoxFit.fill), ), diff --git a/lib/pages/message_notice_page/message_notice_page.dart b/lib/pages/message_notice_page/message_notice_page.dart index aa08af4..4d1e672 100644 --- a/lib/pages/message_notice_page/message_notice_page.dart +++ b/lib/pages/message_notice_page/message_notice_page.dart @@ -60,7 +60,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'type': styleModel?.type, 'title': styleModel?.name}))); } - /// TODO 需要实现 子widget点击事件,公共跳转 + /// 子item点击的公共跳转 void _onItemClick(SkipModel model){ RouterUtil.route(model, model.toJson(), context); } @@ -593,6 +593,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine ); } + /// 转账自定义widget Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { List<Widget> lists = []; transactions.forEach((element) { diff --git a/lib/pages/vip_center_page/vip_center_page.dart b/lib/pages/vip_center_page/vip_center_page.dart index 05796af..5a2601e 100644 --- a/lib/pages/vip_center_page/vip_center_page.dart +++ b/lib/pages/vip_center_page/vip_center_page.dart @@ -68,11 +68,19 @@ class __VipCenterPageContainerState extends State<_VipCenterPageContainer> { if (state is VipCenterInitErrorState) {} /// 加载骨架图 - return Container(); + return _buildSkeletonWidget(); }, ); } + /// 骨架图 + Widget _buildSkeletonWidget(){ + return Scaffold( + appBar: _buildAppBarWidget(null), + body: Container(), + ); + } + /// 主视图 Widget _buildMainWidget(VipCenterStyleModel styleModel) { return MediaQuery.removePadding( diff --git a/lib/register.dart b/lib/register.dart index 1b222f6..e7db5de 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -157,7 +157,7 @@ class BaseWidgetRegister { PageFactory.regist('pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model)); /// 消息设置 PageFactory.regist('pub.flutter.message_settings', (model) => MessageSettingsPage(model)); - ///钱包明细 + /// 钱包明细 PageFactory.regist('pub.flutter.my_bil', (model) => BilDetailPage(model)); } diff --git a/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart b/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart new file mode 100644 index 0000000..391c076 --- /dev/null +++ b/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart @@ -0,0 +1,77 @@ +import 'dart:ui'; +import 'package:provider/provider.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/goods_details_page/notifier/goods_details_appbar_color_notifier.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +class GoodsDetailsAppBarWidget extends StatefulWidget { + @override + _GoodsDetailsAppBarWidgetState createState() => _GoodsDetailsAppBarWidgetState(); +} + +class _GoodsDetailsAppBarWidgetState extends State<GoodsDetailsAppBarWidget> { + + Color _starColor = Colors.transparent; + Color _endBgColor = HexColor.fromHex('#FF4242'); + Color _endTextColor = HexColor.fromHex('#FFFFFF'); + + Color _bgColor = Colors.transparent; + Color _textColor = Colors.transparent; + + @override + void didChangeDependencies() { + GoodsDetailsAppBarColorNotifier notifier = Provider.of<GoodsDetailsAppBarColorNotifier>(context); + if (null != notifier) { + _bgColor = Color.lerp(_starColor, _endBgColor, notifier.percent); + _textColor = Color.lerp(_starColor, _endTextColor, notifier.percent); + } + super.didChangeDependencies(); + } + + @override + Widget build(BuildContext context) { + // Logger.log('^-^'); + return Container( + width: double.infinity, + color: _bgColor, + height: MediaQueryData.fromWindow(window).padding.top + 44, + padding: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: <Widget>[ + Padding( + padding: const EdgeInsets.only(left: 12.5), + child: SizedBox( + width: 40, + height: 40, + child: IconButton( + icon: Icon( + Icons.arrow_back_ios, + size: 22, + color: HexColor.fromHex('#FFFFFF'), + ), + onPressed: () => Navigator.maybePop(context), + ), + )), + Text( + '商品详情', + style: TextStyle(color: _textColor, fontSize: 15, fontWeight: FontWeight.bold), + ), + Padding( + padding: const EdgeInsets.only(right: 12.5), + child: SizedBox( + width: 40, + height: 40, + child: Container( + height: double.infinity, + width: double.infinity, + color: Colors.transparent, + ), + )), + ], + ), + ); + } +} diff --git a/lib/widgets/goods_details/coupon/counpon_widget.dart b/lib/widgets/goods_details/coupon/counpon_widget.dart index 2a44eaf..7825d6d 100644 --- a/lib/widgets/goods_details/coupon/counpon_widget.dart +++ b/lib/widgets/goods_details/coupon/counpon_widget.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/widgets/goods_details/coupon/bloc/bloc.dart'; import 'package:zhiying_base_widget/widgets/goods_details/coupon/bloc/counpon_repository.dart'; @@ -6,6 +8,10 @@ import 'package:zhiying_base_widget/widgets/goods_details/coupon/model/counpon_m import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter_alibc/alibc_model.dart'; +import 'package:flutter_alibc/flutter_alibc.dart'; +import 'package:fluttertoast/fluttertoast.dart'; /// /// 优惠券widget @@ -20,7 +26,10 @@ class CounponWidget extends StatelessWidget { // return Container(); return BlocProvider<CounponBloc>( create: (_) => CounponBloc(repository: CounponRepository()), //..add(CounponInitEvent(model: model)), - child: CounponWidgetContainer(model, key: UniqueKey(),), + child: CounponWidgetContainer( + model, + key: UniqueKey(), + ), ); } } @@ -35,14 +44,50 @@ class CounponWidgetContainer extends StatefulWidget { } class _CounponWidgetContainerState extends State<CounponWidgetContainer> { + UserInfoModel _user; + @override void initState() { BlocProvider.of<CounponBloc>(context).add(CounponInitEvent(model: widget?.model)); super.initState(); } + @override + void didChangeDependencies() { + _user = Provider.of<UserInfoNotifier>(context).userInfo; + super.didChangeDependencies(); + } + /// 点击领取 - void _onJump(CounponModel model) {} + void _onJump(CounponModel model) async{ + print(_user?.toString()); + if (_user?.token == null || _user.token == '') { + print('need login...'); + RouterUtil.goLogin(context); + return; + } + + if (EmptyUtil.isEmpty(model.buy_url)) { + Fluttertoast.showToast(msg: '购买链接不存在'); + return; + } + if (model.provider== 'taobao') { + bool isAuth = await TaobaoAuth.isAuth(); + if (!isAuth) { + TaobaoAuth.auth(context); + return; + } + TradeResult result; + if (Platform.isAndroid) { + result = await FlutterAlibc.openByUrl(url: model.buy_url, backUrl: "alisdk://"); + } else if (Platform.isIOS) { + result = await FlutterAlibc.openByUrl(url: model.buy_url); + } + Logger.debug('${result.errorCode} ${result.errorMessage} '); + } else { + RouterUtil.openWebview(model.buy_url, context); + } + } @override Widget build(BuildContext context) { diff --git a/lib/widgets/goods_details/coupon/model/counpon_model.dart b/lib/widgets/goods_details/coupon/model/counpon_model.dart index 8b6c586..9656c9f 100644 --- a/lib/widgets/goods_details/coupon/model/counpon_model.dart +++ b/lib/widgets/goods_details/coupon/model/counpon_model.dart @@ -9,21 +9,30 @@ class CounponModel { String coupon_url; String price_type; String price_type_color; + String buy_url; + String provider; + String goood_id; - CounponModel( - {this.bg_img, - this.coupon_endtime, - this.coupon_price, - this.coupon_price_color, - this.coupon_time_color, - this.coupon_title, - this.coupon_title_color, - this.coupon_url, - this.price_type, - this.price_type_color}); + CounponModel({ + this.goood_id, + this.provider, + this.bg_img, + this.coupon_endtime, + this.coupon_price, + this.coupon_price_color, + this.coupon_time_color, + this.coupon_title, + this.coupon_title_color, + this.coupon_url, + this.price_type, + this.price_type_color, + this.buy_url, + }); factory CounponModel.fromJson(Map<String, dynamic> json) { return CounponModel( + goood_id: json['goood_id'], + provider: json['provider'], bg_img: json['bg_img'], coupon_endtime: json['coupon_endtime'], coupon_price: json['coupon_price'], @@ -34,6 +43,7 @@ class CounponModel { coupon_url: json['coupon_url'], price_type: json['price_type'], price_type_color: json['price_type_color'], + buy_url: json['buy_url'], ); } @@ -49,6 +59,9 @@ class CounponModel { data['coupon_url'] = this.coupon_url; data['price_type'] = this.price_type; data['price_type_color'] = this.price_type_color; + data['buy_url'] = this.buy_url; + data['provider'] = this.provider; + data['goood_id'] = this.goood_id; return data; } } diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index 0c8c826..3b7a6d9 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -63,6 +63,12 @@ class _GooddsDetailsFooterContainerState super.initState(); } + @override + void didChangeDependencies() { + _user = Provider.of<UserInfoNotifier>(context).userInfo; + super.didChangeDependencies(); + } + /// 打开首页 void _openHome() { Navigator.pushAndRemoveUntil( @@ -159,7 +165,6 @@ class _GooddsDetailsFooterContainerState @override Widget build(BuildContext context) { - _user = Provider.of<UserInfoNotifier>(context).userInfo; return BlocConsumer<GoodsDetailsFooterBloc, GoodsDetailsFooterState>( listener: (context, state) {}, buildWhen: (prev, current) { diff --git a/lib/widgets/goods_details/store/store_widget.dart b/lib/widgets/goods_details/store/store_widget.dart index 60d05b8..9d3f301 100644 --- a/lib/widgets/goods_details/store/store_widget.dart +++ b/lib/widgets/goods_details/store/store_widget.dart @@ -20,8 +20,11 @@ class StoreWidget extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider<StoreBloc>( - create: (_) => StoreBloc(repository: StoreRepository()),//..add(StoreInitEvent(model: model)), - child: StoreContainer(model, key: UniqueKey(),), + create: (_) => StoreBloc(repository: StoreRepository()), //..add(StoreInitEvent(model: model)), + child: StoreContainer( + model, + key: UniqueKey(), + ), ); } } @@ -36,7 +39,6 @@ class StoreContainer extends StatefulWidget { } class _StoreContainerState extends State<StoreContainer> { - @override void initState() { BlocProvider.of<StoreBloc>(context).add(StoreInitEvent(model: widget?.model)); @@ -105,7 +107,7 @@ class _StoreContainerState extends State<StoreContainer> { height: 50, // color: Colors.red, child: CachedNetworkImage( - imageUrl: model?.shop_avatar?? '', + imageUrl: model?.shop_avatar ?? '', fit: BoxFit.fill, ), ); @@ -120,8 +122,8 @@ class _StoreContainerState extends State<StoreContainer> { /// 商店名称 Text(model?.shop_name ?? '品胜京东自营旗舰店', style: TextStyle(color: HexColor.fromHex(model?.shop_name_color ?? '#333333'), fontSize: 13, fontWeight: FontWeight.bold)), - /// 更多 - Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11)), + /// 更多 TODO 暂时隐藏,等后台有数据后再打开 + Visibility(visible: false, child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))), ], ); } @@ -132,10 +134,10 @@ class _StoreContainerState extends State<StoreContainer> { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ /// 宝贝描述 5.0 - _getCoustomWidet(model?.description ?? '宝贝描述 5.0',model?.description_color ?? '#999999', model?.description_leve_icon ?? ''), + _getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999', model?.description_leve_icon ?? ''), /// 物流服务 5.0 - _getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''), + _getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''), /// 服务态度 1.0 _getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''), @@ -154,7 +156,6 @@ class _StoreContainerState extends State<StoreContainer> { // color: Colors.red, child: CachedNetworkImage( imageUrl: icon ?? '', - ), ), ], diff --git a/lib/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart b/lib/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart index 237b272..0598715 100644 --- a/lib/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart +++ b/lib/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart @@ -12,31 +12,25 @@ class HotRankingGoods extends StatelessWidget { HotRankingListModel styleModel; int index; - HotRankingGoods({Key key, this.good, this.styleModel, this.index}) - : super(key: key); + HotRankingGoods({Key key, this.good, this.styleModel, this.index}) : super(key: key); @override Widget build(BuildContext context) { var indexImage; - if (styleModel.hotRankIconList != null && - styleModel.hotRankIconList.length > 0 && - styleModel.hotRankIconList.length - 1 >= index) { + if (styleModel.hotRankIconList != null && styleModel.hotRankIconList.length > 0 && styleModel.hotRankIconList.length - 1 >= index) { indexImage = styleModel.hotRankIconList[index]; } Providers providers = getProvider(good.provider); return GestureDetector( onTap: () { - RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), - good?.toJson(), context); + RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), good?.toJson(), context); }, child: Stack( children: <Widget>[ Container( padding: EdgeInsets.all(15.w), - margin: - EdgeInsets.only(top: 8.w, bottom: 8.w, left: 25.w, right: 25.w), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(15.w)), + margin: EdgeInsets.only(top: 8.w, bottom: 8.w, left: 25.w, right: 25.w), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15.w)), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ @@ -50,9 +44,9 @@ class HotRankingGoods extends StatelessWidget { imageUrl: good?.goodImage ?? '', ), ), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(6)), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(6)), ), + /// 商品图片右边视图 Expanded( child: Container( @@ -70,16 +64,8 @@ class HotRankingGoods extends StatelessWidget { WidgetSpan( alignment: ui.PlaceholderAlignment.middle, child: Container( - padding: EdgeInsets.only( - left: 4.w, - right: 4.w, - top: 1, - bottom: 1), - decoration: BoxDecoration( - color: HexColor.fromHex( - providers.providerBgColor), - borderRadius: - BorderRadius.circular(2.5)), + padding: EdgeInsets.only(left: 4.w, right: 4.w, top: 1, bottom: 1), + decoration: BoxDecoration(color: HexColor.fromHex(providers.providerBgColor), borderRadius: BorderRadius.circular(2.5)), child: Text( good.providerName ?? "", style: TextStyle( @@ -93,12 +79,7 @@ class HotRankingGoods extends StatelessWidget { child: SizedBox( width: 4.h, )), - TextSpan( - text: good.goodTitle, - style: TextStyle( - color: HexColor.fromHex( - styleModel.titleColor ?? ""), - fontSize: 30.sp)) + TextSpan(text: good.goodTitle, style: TextStyle(color: HexColor.fromHex(styleModel.titleColor ?? ""), fontSize: 30.sp)) ])), /// 优惠券 @@ -107,29 +88,16 @@ class HotRankingGoods extends StatelessWidget { good.coupon == "" ? Container() : Container( - margin: EdgeInsets.only( - top: 4, bottom: 4, right: 15.w), + margin: EdgeInsets.only(top: 4, bottom: 4, right: 15.w), decoration: BoxDecoration( - color: HexColor.fromHex(styleModel - .couponCommission.left.couponBgColor), - image: DecorationImage( - image: CachedNetworkImageProvider( - styleModel.couponCommission.left - .couponBgImg))), + borderRadius: BorderRadius.circular(2.5), + color: HexColor.fromHex(styleModel.couponCommission.left.couponBgColor), + image: DecorationImage(image: CachedNetworkImageProvider(styleModel.couponCommission.left.couponBgImg))), child: Padding( - padding: const EdgeInsets.only( - left: 8, right: 8, top: 2, bottom: 2), + padding: const EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), child: Text( - (good.coupon ?? "") + - (styleModel.couponCommission.left - .couonText ?? - ""), - style: TextStyle( - color: HexColor.fromHex(styleModel - .couponCommission - .left - .couponFontColor), - fontSize: 22.sp), + (good.coupon ?? "") + (styleModel.couponCommission.left.couonText ?? ""), + style: TextStyle(color: HexColor.fromHex(styleModel.couponCommission.left.couponFontColor), fontSize: 22.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), ), ), ), @@ -138,30 +106,14 @@ class HotRankingGoods extends StatelessWidget { : Container( margin: EdgeInsets.only(top: 4, bottom: 4), decoration: BoxDecoration( - color: HexColor.fromHex(styleModel - .couponCommission - .right - .commissionBgColor ?? - ""), - image: DecorationImage( - image: CachedNetworkImageProvider( - styleModel.couponCommission.right - .commissionBgImg ?? - ""))), + borderRadius: BorderRadius.circular(2.5), + color: HexColor.fromHex(styleModel.couponCommission.right.commissionBgColor ?? ""), + image: DecorationImage(image: CachedNetworkImageProvider(styleModel.couponCommission.right.commissionBgImg ?? ""))), child: Padding( - padding: const EdgeInsets.only( - left: 8, right: 8, top: 2, bottom: 2), + padding: const EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), child: Text( - (styleModel.couponCommission.right - .commissionText ?? - "") + - (good.commission ?? ""), - style: TextStyle( - color: HexColor.fromHex(styleModel - .couponCommission - .right - .commissionFontColor), - fontSize: 22.sp), + (styleModel.couponCommission.right.commissionText ?? "") + (good.commission ?? ""), + style: TextStyle(color: HexColor.fromHex(styleModel.couponCommission.right.commissionFontColor), fontSize: 22.sp,fontFamily: 'Din', package: 'zhiying_base_widget'), ), ), ), @@ -178,18 +130,12 @@ class HotRankingGoods extends StatelessWidget { padding: EdgeInsets.only(bottom: 6.sp), child: Text( "¥", - style: TextStyle( - color: HexColor.fromHex( - styleModel.currentPriceColor ?? ""), - fontSize: 20.sp), + style: TextStyle(color: HexColor.fromHex(styleModel.currentPriceColor ?? ""), fontSize: 20.sp), ), ), Text( good.currentPrice ?? "", - style: TextStyle( - color: HexColor.fromHex( - styleModel.currentPriceColor ?? ""), - fontSize: 40.sp), + style: TextStyle(color: HexColor.fromHex(styleModel.currentPriceColor ?? ""), fontSize: 40.sp,fontWeight: FontWeight.bold ,fontFamily: 'Din', package: 'zhiying_base_widget'), ), SizedBox( width: 6, @@ -198,11 +144,7 @@ class HotRankingGoods extends StatelessWidget { padding: EdgeInsets.only(bottom: 4.sp), child: Text( "¥" + good.marketPrice ?? "", - style: TextStyle( - color: HexColor.fromHex( - styleModel.marketPriceColor ?? ""), - fontSize: 22.sp, - decoration: TextDecoration.lineThrough), + style: TextStyle(color: HexColor.fromHex(styleModel.marketPriceColor ?? ""), fontSize: 22.sp, decoration: TextDecoration.lineThrough, fontFamily: 'Din', package: 'zhiying_base_widget'), ), ), ], @@ -225,14 +167,11 @@ class HotRankingGoods extends StatelessWidget { padding: EdgeInsets.only( left: 40.w, ), - margin: - EdgeInsets.only(right: 20, left: 20.w), - color: HexColor.fromHex( - styleModel.hotRank.bgColor ?? ""), + margin: EdgeInsets.only(right: 20, left: 20.w), + color: HexColor.fromHex(styleModel.hotRank.bgColor ?? ""), child: Text( "热销" + good.inorderCount + "件", - style: TextStyle( - color: Colors.white, fontSize: 22.sp), + style: TextStyle(color: Colors.white, fontSize: 22.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), ), )) ], @@ -241,12 +180,10 @@ class HotRankingGoods extends StatelessWidget { width: 48.w, height: 48.w, child: CachedNetworkImage( - imageUrl: - styleModel?.hotRank?.hotSaleImg ?? "", + imageUrl: styleModel?.hotRank?.hotSaleImg ?? "", width: 48.w, height: 48.w, - placeholder: (context, _) => - Container(color: Colors.yellow), + placeholder: (context, _) => Container(color: Colors.yellow), fit: BoxFit.fill, ), ), @@ -256,13 +193,8 @@ class HotRankingGoods extends StatelessWidget { height: 48.h, width: 127.w, decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider( - styleModel.hotRank.buyNowImg ?? - ""), - fit: BoxFit.fitWidth), - borderRadius: - BorderRadius.circular(20)), + image: DecorationImage(image: CachedNetworkImageProvider(styleModel.hotRank.buyNowImg ?? ""), fit: BoxFit.fitWidth), + borderRadius: BorderRadius.circular(20)), margin: EdgeInsets.only(right: 0), )) ], @@ -278,9 +210,7 @@ class HotRankingGoods extends StatelessWidget { Align( alignment: Alignment.topLeft, child: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider(indexImage ?? ""))), + decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(indexImage ?? ""))), margin: EdgeInsets.only(left: 40.w, top: 8.h), height: 60.w, width: 60.w, diff --git a/lib/widgets/hot_ranking/hot_tab_bar/hot_tab_bar.dart b/lib/widgets/hot_ranking/hot_tab_bar/hot_tab_bar.dart index af5afb6..79a9c5b 100644 --- a/lib/widgets/hot_ranking/hot_tab_bar/hot_tab_bar.dart +++ b/lib/widgets/hot_ranking/hot_tab_bar/hot_tab_bar.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; +import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'package:zhiying_base_widget/pages/hot_ranking_page/hot_ranking_page_bloc.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/util/extension/color.dart'; @@ -54,7 +55,9 @@ class _HotRankTableBarState extends State<HotRankTableBar> return Container( margin: EdgeInsets.only(bottom: 10), child: TabBar( - indicatorPadding: EdgeInsets.only(bottom: 0), + // indicatorPadding: EdgeInsets.only(bottom: 0, top: 10), + // indicatorWeight: 3, + indicatorWeight: 6, indicatorSize: TabBarIndicatorSize.label, controller: _tabController, indicatorColor: HexColor.fromHex( @@ -63,6 +66,15 @@ class _HotRankTableBarState extends State<HotRankTableBar> _barModel.tabList[_tabController.index].nameNoSelectColor), labelColor: HexColor.fromHex( _barModel.tabList[_tabController.index].nameSelectColor), + indicator: MaterialIndicator( + height: 2.5, + horizontalPadding: 8, + bottomRightRadius: 1.25, + bottomLeftRadius: 1.25, + topRightRadius: 1.25, + topLeftRadius: 1.25, + color: HexColor.fromHex(_barModel.tabList[_tabController.index].nameSelectColor), + ), isScrollable: true, tabs: _buildTabs(), onTap: (index) { diff --git a/lib/widgets/wallet/wallet_appbar/wallet_appbar.dart b/lib/widgets/wallet/wallet_appbar/wallet_appbar.dart index 4f3d8ad..34f36da 100644 --- a/lib/widgets/wallet/wallet_appbar/wallet_appbar.dart +++ b/lib/widgets/wallet/wallet_appbar/wallet_appbar.dart @@ -1,9 +1,10 @@ import 'dart:convert'; import 'package:flutter/material.dart'; -import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/model/WalletAppbarModel.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; +import 'model/wallet_appbar_model.dart'; + class WalletAppbar extends StatelessWidget { final Map<String, dynamic> data; diff --git a/lib/widgets/wallet/wallet_detail/wallet_detail.dart b/lib/widgets/wallet/wallet_detail/wallet_detail.dart index 0c5b2ec..b095863 100644 --- a/lib/widgets/wallet/wallet_detail/wallet_detail.dart +++ b/lib/widgets/wallet/wallet_detail/wallet_detail.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page.dart'; import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; @@ -25,8 +26,7 @@ class WalletDetail extends StatefulWidget { _WalletDetailState createState() => _WalletDetailState(); } -class _WalletDetailState extends State<WalletDetail> - with TickerProviderStateMixin { +class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMixin { WalletDetailModel _model; TabController _tabController; @@ -37,8 +37,7 @@ class _WalletDetailState extends State<WalletDetail> void initState() { if (widget.data != null) { _model = WalletDetailModel.fromJson(json.decode(widget.data['data'])); - _tabController = - TabController(length: _model.providers.length, vsync: this); + _tabController = TabController(length: _model.providers.length, vsync: this); } _bloc = new WalletDetailBloc(); _bloc.loadData(_model.providers[0].type); @@ -55,23 +54,29 @@ class _WalletDetailState extends State<WalletDetail> return WalletDetailSkeleton(); } return Container( - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(8)), - margin: - EdgeInsets.only(left: 12.5, right: 12.5, top: 15.h, bottom: 15.h), - padding: EdgeInsets.only(bottom: 15.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), + margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 15.h, bottom: 15.h), + padding: const EdgeInsets.only(bottom: 13), child: Column( children: <Widget>[ Container( + padding: EdgeInsets.only(top: 12), child: TabBar( + indicatorWeight: 3, + indicator: MaterialIndicator( + height: 2, + bottomLeftRadius: 1, + bottomRightRadius: 1, + horizontalPadding: 0, + topLeftRadius: 1, + topRightRadius: 1, + color: HexColor.fromHex(_model.providers[0].selectColor), + ), isScrollable: true, - unselectedLabelColor: - HexColor.fromHex(_model.providers[0].unselectColor), - labelColor: - HexColor.fromHex(_model.providers[0].selectColor), + unselectedLabelColor: HexColor.fromHex(_model.providers[0].unselectColor), + labelColor: HexColor.fromHex(_model.providers[0].selectColor), controller: _tabController, - indicatorColor: - HexColor.fromHex(_model.providers[0].selectColor), + indicatorColor: HexColor.fromHex(_model.providers[0].selectColor), indicatorSize: TabBarIndicatorSize.label, onTap: (index) { ///变更平台 @@ -83,21 +88,21 @@ class _WalletDetailState extends State<WalletDetail> ///日期选择 Container( height: 100.h, + alignment: Alignment.center, child: ListView.builder( - padding: EdgeInsets.only(top: 16,left: 16.w), - itemCount: _model.dateList.length, - scrollDirection: Axis.horizontal, - itemBuilder: _buildTimeItem), + padding: EdgeInsets.only( left: 16.w), + itemCount: _model.dateList.length, + scrollDirection: Axis.horizontal, + itemBuilder: _buildTimeItem, + ), ), + + /// 数据 Container( height: 126.h, margin: EdgeInsets.only(top: 16, left: 30.w, right: 30.w), width: double.infinity, - decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider( - _model.providerDashbord.finish.bgImg), - fit: BoxFit.fill)), + decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(_model.providerDashbord.finish.bgImg), fit: BoxFit.fill)), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ @@ -107,10 +112,7 @@ class _WalletDetailState extends State<WalletDetail> padding: const EdgeInsets.all(8.0), child: Text( _model.providerDashbord.finish.text, - style: TextStyle( - fontSize: 28.sp, - color: HexColor.fromHex(_model - .providerDashbord.finish.textColor)), + style: TextStyle(fontSize: 28.sp, color: HexColor.fromHex(_model.providerDashbord.finish.textColor)), ), ), Row( @@ -118,16 +120,13 @@ class _WalletDetailState extends State<WalletDetail> children: <Widget>[ Text( _model.providerDashbord.finish.text ?? "", - style: - TextStyle(color: Colors.black, fontSize: 22.sp), + style: TextStyle(color: Colors.black, fontSize: 22.sp), ), InkWell( child: Padding( padding: const EdgeInsets.all(8.0), child: CachedNetworkImage( - imageUrl: - _model.providerDashbord.finish.tipIcon ?? - "", + imageUrl: _model.providerDashbord.finish.tipIcon ?? "", width: 20.h, height: 20.h, fit: BoxFit.fill, @@ -135,14 +134,13 @@ class _WalletDetailState extends State<WalletDetail> ), onTap: () { ///显示弹窗 - showTipDialog( - null, _model.providerDashbord.finish.tipText); + showTipDialog(null, _model.providerDashbord.finish.tipText); }) ], ), Text( _bloc.selectDateData.finish ?? "", - style: TextStyle(color: Colors.red, fontSize: 40.sp), + style: TextStyle(color: Colors.red, fontSize: 40.sp, fontFamily: 'Din', package: 'zhiying_base_widget', fontWeight: FontWeight.bold), ) ], ), @@ -154,8 +152,7 @@ class _WalletDetailState extends State<WalletDetail> shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemBuilder: (context, index) { - return _buildBottomItem( - context, index, _model.providerDashbord); + return _buildBottomItem(context, index, _model.providerDashbord); }), ) ], @@ -169,11 +166,9 @@ class _WalletDetailState extends State<WalletDetail> _buildTabs() { List<Widget> listWidget = List(); for (var item in _model.providers) { - listWidget.add(Tab( - child: Text( - item.name, - style: TextStyle(fontSize: 28.sp), - ), + listWidget.add(Text( + item.name, + style: TextStyle(fontSize: 14, ), )); } return listWidget; @@ -185,23 +180,14 @@ class _WalletDetailState extends State<WalletDetail> child: Container( margin: EdgeInsets.only(top: 0, left: 8, right: 8), decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider( - item.type == _bloc.selectDateData.type - ? item.btnImg ?? "" - : item.btnNoColorImg ?? ""), - fit: BoxFit.fitWidth), + image: DecorationImage(image: CachedNetworkImageProvider(item.type == _bloc.selectDateData.type ? item.btnImg ?? "" : item.btnNoColorImg ?? ""), fit: BoxFit.fitWidth), ), child: Padding( padding: const EdgeInsets.only(left: 16, right: 16), child: Center( child: Text( item.text, - style: TextStyle( - fontSize: 22.sp, - color: HexColor.fromHex(item.type == _bloc.selectDateData.type - ? item.textSelectColor - : item.textUnselectColor)), + style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.type == _bloc.selectDateData.type ? item.textSelectColor : item.textUnselectColor)), )), ), ), @@ -218,8 +204,7 @@ class _WalletDetailState extends State<WalletDetail> } ///底部显示 - Widget _buildBottomItem( - BuildContext context, int index, ProviderDashbord dashbord) { + Widget _buildBottomItem(BuildContext context, int index, ProviderDashbord dashbord) { SelfBuy item; if (index == 0) { item = dashbord.selfBuy; @@ -241,9 +226,7 @@ class _WalletDetailState extends State<WalletDetail> ? Container() : Text( item.title, - style: TextStyle( - color: HexColor.fromHex(item.titleColor), - fontSize: 28.sp), + style: TextStyle(color: HexColor.fromHex(item.titleColor), fontSize: 28.sp), ), SizedBox( height: 15.h, @@ -256,11 +239,7 @@ class _WalletDetailState extends State<WalletDetail> height: 123.h, margin: EdgeInsets.only(right: 8, left: 30.w), padding: EdgeInsets.only(left: 20.w), - decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider( - item.itemList[0].bgImg ?? ""), - fit: BoxFit.fill)), + decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[0].bgImg ?? ""), fit: BoxFit.fill)), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -269,10 +248,7 @@ class _WalletDetailState extends State<WalletDetail> children: <Widget>[ Text( item.itemList[0].text ?? "", - style: TextStyle( - fontSize: 22.sp, - color: HexColor.fromHex( - item.itemList[0].textColor)), + style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.itemList[0].textColor)), ), InkWell( child: Padding( @@ -293,9 +269,11 @@ class _WalletDetailState extends State<WalletDetail> ), Text(dataMap[item.itemList[0].vauleKey], style: TextStyle( + fontFamily: 'Din', + package: 'zhiying_base_widget', + fontWeight: FontWeight.bold, fontSize: 34.sp, - color: - HexColor.fromHex(item.itemList[1].valueColor), + color: HexColor.fromHex(item.itemList[1].valueColor), )) ], )), @@ -305,11 +283,7 @@ class _WalletDetailState extends State<WalletDetail> height: 123.h, margin: EdgeInsets.only(left: 8, right: 30.w), padding: EdgeInsets.only(left: 20.w), - decoration: BoxDecoration( - image: DecorationImage( - image: CachedNetworkImageProvider( - item.itemList[1].bgImg ?? ""), - fit: BoxFit.fill)), + decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[1].bgImg ?? ""), fit: BoxFit.fill)), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -318,10 +292,7 @@ class _WalletDetailState extends State<WalletDetail> children: <Widget>[ Text( item.itemList[1].text ?? "", - style: TextStyle( - fontSize: 22.sp, - color: - HexColor.fromHex(item.itemList[1].textColor)), + style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.itemList[1].textColor)), ), InkWell( child: Padding( @@ -343,8 +314,7 @@ class _WalletDetailState extends State<WalletDetail> Text( dataMap[item.itemList[1].vauleKey], style: TextStyle( - fontSize: 34.sp, - color: HexColor.fromHex(item.itemList[1].valueColor)), + fontSize: 34.sp, color: HexColor.fromHex(item.itemList[1].valueColor), fontFamily: 'Din', package: 'zhiying_base_widget', fontWeight: FontWeight.bold), ) ], ), diff --git a/lib/widgets/wallet_bil_detail/wallet_bil_detail.dart b/lib/widgets/wallet_bil_detail/wallet_bil_detail.dart index 49babe7..3ceefde 100644 --- a/lib/widgets/wallet_bil_detail/wallet_bil_detail.dart +++ b/lib/widgets/wallet_bil_detail/wallet_bil_detail.dart @@ -4,11 +4,13 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'package:zhiying_base_widget/dialog/select_date_ym_dialog/select_date_ym_dialog.dart'; import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_bloc.dart'; import 'package:zhiying_base_widget/widgets/wallet_bil_detail/wallet_bil_detail_widget_bloc.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/util/extension/color.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'model/wallet_style_model.dart'; @@ -24,8 +26,7 @@ class WalletBilDetail extends StatefulWidget { _WalletBilDetailState createState() => _WalletBilDetailState(); } -class _WalletBilDetailState extends State<WalletBilDetail> - with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { +class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { WalletBilDetailWidgetBloc _bloc; TabController _tabController; @@ -34,8 +35,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> void initState() { _bloc = WalletBilDetailWidgetBloc(); _bloc.initStyleData(json.decode(widget.data['data'])); - _tabController = - TabController(length: _bloc.styleData.tabList.length, vsync: this); + _tabController = TabController(length: _bloc.styleData.tabList.length, vsync: this); _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); _bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate); @@ -51,8 +51,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ AppBar( brightness: Brightness.light, - backgroundColor: - HexColor.fromHex(_bloc.styleData.appBarBgColor), + backgroundColor: HexColor.fromHex(_bloc.styleData.appBarBgColor), centerTitle: true, leading: IconButton( icon: Icon( @@ -65,29 +64,32 @@ class _WalletBilDetailState extends State<WalletBilDetail> }), title: Text( _bloc.styleData.appBarName ?? "", - style: TextStyle( - color: HexColor.fromHex(_bloc.styleData.appBarNameColor)), + style: TextStyle(color: HexColor.fromHex(_bloc.styleData.appBarNameColor), fontWeight: FontWeight.bold, fontSize: 18), ), ), Container( color: Colors.white, child: TabBar( + indicator: MaterialIndicator( + height: 3, + horizontalPadding: 15, + bottomRightRadius: 1.5, + bottomLeftRadius: 1.5, + topRightRadius: 1.5, + topLeftRadius: 1.5, + color: HexColor.fromHex(_bloc.styleData.tabLineColor)), controller: _tabController, tabs: _buildTabBarItem(), - indicatorWeight: 3, - labelStyle: TextStyle(fontSize: 30.sp), + indicatorWeight: 9.5, + labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), + unselectedLabelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), labelColor: HexColor.fromHex(_bloc.styleData.tabSeletedColor), - unselectedLabelColor: - HexColor.fromHex(_bloc.styleData.tabNoSeletedColor), - indicatorColor: - HexColor.fromHex(_bloc.styleData.tabLineColor), + unselectedLabelColor: HexColor.fromHex(_bloc.styleData.tabNoSeletedColor), + indicatorColor: HexColor.fromHex(_bloc.styleData.tabLineColor), indicatorSize: TabBarIndicatorSize.label, ), ), - Expanded( - child: TabBarView( - controller: _tabController, - children: _buildTabViewPage())) + Expanded(child: TabBarView(controller: _tabController, children: _buildTabViewPage())) ], ), )); @@ -97,9 +99,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> _buildTabBarItem() { List<Widget> listWidget = List(); for (var item in _bloc.styleData.tabList) { - listWidget.add(Tab( - text: item.name ?? "", - )); + listWidget.add(Text( + item.name ?? "", + ) + // Tab(text: item.name ?? ""), + ); } return listWidget; } @@ -110,7 +114,6 @@ class _WalletBilDetailState extends State<WalletBilDetail> selectType = _bloc.inputSelectType; } else { selectType = _bloc.outputSelectType; - ; } return Row( children: <Widget>[ @@ -122,14 +125,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> }, child: Padding( padding: const EdgeInsets.only(top: 8, bottom: 8), - child: Text( - tabList.type == "input" - ? _bloc.inputShowDate - : _bloc.outputShowDate, - style: TextStyle( - fontSize: 28.sp, - color: - HexColor.fromHex(_bloc.styleData.timeSelectColor)))), + child: Text(tabList.type == "input" ? _bloc.inputShowDate : _bloc.outputShowDate, + style: TextStyle(fontSize: 28.sp, color: HexColor.fromHex(_bloc.styleData.timeSelectColor), fontWeight: FontWeight.bold))), ), Icon( Icons.arrow_drop_down, @@ -137,53 +134,43 @@ class _WalletBilDetailState extends State<WalletBilDetail> ), Expanded( child: Container( - height: 50, + margin: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5), + height: 25, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, itemCount: tabViewBtns.length, itemBuilder: (context, index) { - return InkWell( - onTap: () async { - if (tabList.type == 'input') { - _bloc.inputSelectType = tabViewBtns[index].type; - _bloc.inPutCurrentPage=1; - _bloc.loadInputData( - _bloc.inPutCurrentPage, _bloc.inputShowDate, - type: _bloc.inputSelectType); - } else { - _bloc.outputSelectType = tabViewBtns[index].type; - _bloc.outPutCurrentPage=1; - _bloc.loadOutputData( - _bloc.outPutCurrentPage, _bloc.outputShowDate, - type: _bloc.outputSelectType); - } - _bloc.refresh(); - }, - child: Container( - margin: EdgeInsets.only( - top: 10, left: 8, right: 8, bottom: 10), - decoration: BoxDecoration( - border: Border.all( - color: HexColor.fromHex( - selectType == tabViewBtns[index].type - ? _bloc.styleData.btnSelectedColor - : _bloc.styleData.btnNoSelectedColor), - ), - borderRadius: BorderRadius.circular(50)), - child: Padding( - padding: EdgeInsets.only(left: 16, right: 16), - child: Center( - child: Text( - tabViewBtns[index].name ?? "", - style: TextStyle( - color: HexColor.fromHex( - selectType == tabViewBtns[index].type - ? _bloc.styleData.btnSelectedColor - : _bloc.styleData.btnNoSelectedColor)), - )), - ), - )); + return GestureDetector( + onTap: () async { + if (tabList.type == 'input') { + _bloc.inputSelectType = tabViewBtns[index].type; + _bloc.inPutCurrentPage = 1; + _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate, type: _bloc.inputSelectType); + } else { + _bloc.outputSelectType = tabViewBtns[index].type; + _bloc.outPutCurrentPage = 1; + _bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate, type: _bloc.outputSelectType); + } + _bloc.refresh(); + }, + behavior: HitTestBehavior.opaque, + child: Container( + alignment: Alignment.center, + margin: EdgeInsets.only(right: 12.5), + padding: EdgeInsets.only(left: 16, right: 16, top: 2.5, bottom: 2.5), + decoration: BoxDecoration( + border: Border.all( + color: HexColor.fromHex(selectType == tabViewBtns[index].type ? _bloc.styleData.btnSelectedColor : _bloc.styleData.btnNoSelectedColor), + ), + borderRadius: BorderRadius.circular(50)), + child: Text( + tabViewBtns[index].name ?? "", + style: TextStyle( + fontSize: 11, color: HexColor.fromHex(selectType == tabViewBtns[index].type ? _bloc.styleData.btnSelectedColor : _bloc.styleData.btnNoSelectedColor)), + ), + ), + ); }), )) ], @@ -191,11 +178,9 @@ class _WalletBilDetailState extends State<WalletBilDetail> } _selectDate(TabList tabList) async { - var result = await showDialog( - context: context, builder: (context) => SelectDateYMDialog()); + var result = await showDialog(context: context, builder: (context) => SelectDateYMDialog()); if (result != null) { - var dataTime = DateFormat('yyyy-MM').format( - DateTime(int.parse(result['year']), int.parse(result['month']))); + var dataTime = DateFormat('yyyy-MM').format(DateTime(int.parse(result['year']), int.parse(result['month']))); if (tabList.type == "input") { _bloc.inputShowDate = dataTime; _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); @@ -210,9 +195,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> _buildBottomItem(TabList tabList) { return ListView.builder( shrinkWrap: true, - itemCount: tabList.type == 'input' - ? _bloc.inputDataVM.length - : _bloc.outputDataVM.length, + itemCount: tabList.type == 'input' ? _bloc.inputDataVM.length : _bloc.outputDataVM.length, itemBuilder: (context, index) { return _buildItem(context, index, tabList); }); @@ -224,11 +207,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> var modelItem = _bloc.inputDataVM[index]; return Container( margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), - padding: - EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), - decoration: BoxDecoration( - color: HexColor.fromHex("#FFFFFF"), - borderRadius: BorderRadius.circular(8)), + padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), + decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), child: Column( children: <Widget>[ Row( @@ -238,21 +218,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Container( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: HexColor.fromHex("#FFFFF3F3"), - border: Border.all( - color: HexColor.fromHex( - inputItemStyle.typeNameColor))), + borderRadius: BorderRadius.circular(4), color: HexColor.fromHex("#FFFFF3F3"), border: Border.all(color: HexColor.fromHex(inputItemStyle.typeNameColor))), child: Padding( - padding: const EdgeInsets.only( - left: 4, right: 4, top: 2, bottom: 2), + padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), child: Center( child: Text( modelItem['type'] ?? "", - style: TextStyle( - color: HexColor.fromHex( - inputItemStyle.typeNameColor), - fontSize: 20.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.typeNameColor), fontSize: 20.sp), ), ), ), @@ -272,14 +244,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( "+ ", - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.amountColor)), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor)), ), Text( "¥ " + modelItem['amount'], - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.amountColor), - fontSize: 30.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor), fontSize: 30.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), ) ], ) @@ -294,44 +263,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( inputItemStyle.orderIdText, - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['order_id'], - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 28.w, ), GestureDetector( onTap: () { - Clipboard.setData( - ClipboardData(text: modelItem['order_id'])); + Clipboard.setData(ClipboardData(text: modelItem['order_id'])); Fluttertoast.showToast(msg: "已复制"); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: HexColor.fromHex(inputItemStyle.copyBtnBgColor), - border: Border.all( - color: - HexColor.fromHex(inputItemStyle.contentColor))), + border: Border.all(color: HexColor.fromHex(inputItemStyle.contentColor))), child: Padding( - padding: EdgeInsets.only( - left: 16, right: 16, top: 1, bottom: 1), + padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), child: Text( inputItemStyle.copyBtnText, - style: TextStyle( - color: - HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), ), ), @@ -348,18 +306,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( inputItemStyle.orderTypeText, - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['order_type'] ?? "", - style: TextStyle( - color: HexColor.fromHex("#FF999999"), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), ), ], )), @@ -368,9 +322,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( inputItemStyle.amountText + " ¥" + modelItem['amount'], - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), ], )) @@ -386,18 +338,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( inputItemStyle.timeText, - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['time'] ?? "", - style: TextStyle( - color: HexColor.fromHex("#FF999999"), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), ), ], )), @@ -405,13 +353,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> child: Row( children: <Widget>[ Text( - inputItemStyle.settleTimeText + - " " + - modelItem['settle_time'] ?? - "", - style: TextStyle( - color: HexColor.fromHex(inputItemStyle.contentColor), - fontSize: 22.sp), + inputItemStyle.settleTimeText + " " + modelItem['settle_time'] ?? "", + style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), ), ], )) @@ -427,11 +370,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> ///消费返回的Item return Container( margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), - padding: - EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), - decoration: BoxDecoration( - color: HexColor.fromHex("#FFFFFF"), - borderRadius: BorderRadius.circular(8)), + padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), + decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), child: Column( children: <Widget>[ Row( @@ -443,19 +383,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: HexColor.fromHex("#FFFFF3F3"), - border: Border.all( - color: HexColor.fromHex( - outputItemStyle.typeNameColor))), + border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))), child: Padding( - padding: const EdgeInsets.only( - left: 4, right: 4, top: 2, bottom: 2), + padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), child: Center( child: Text( modelItem['type'] ?? "", - style: TextStyle( - color: HexColor.fromHex( - outputItemStyle.typeNameColor), - fontSize: 20.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp), ), ), ), @@ -475,16 +409,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( "- ", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.amountColor)), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)), ), Text( "¥ " + modelItem['amount'], - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.amountColor), - fontSize: 30.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp), ) ], ) @@ -499,44 +428,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.orderIdText, - style: TextStyle( - color: HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['order_id'], - style: TextStyle( - color: HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 28.w, ), GestureDetector( onTap: () { - Clipboard.setData( - ClipboardData(text: modelItem['order_id'])); + Clipboard.setData(ClipboardData(text: modelItem['order_id'])); Fluttertoast.showToast(msg: "已复制"); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), - border: Border.all( - color: HexColor.fromHex( - outputItemStyle.contentColor))), + border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))), child: Padding( - padding: EdgeInsets.only( - left: 16, right: 16, top: 1, bottom: 1), + padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), child: Text( outputItemStyle.copyBtnText ?? "", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ), ), @@ -553,19 +471,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.consumeOrderTypeText, - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['order_type'] ?? "", - style: TextStyle( - color: HexColor.fromHex("#FF999999"), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), ), ], )), @@ -573,13 +486,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> child: Row( children: <Widget>[ Text( - outputItemStyle.consumeAmountText + - " ¥" + - modelItem['amount'], - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + outputItemStyle.consumeAmountText + " ¥" + modelItem['amount'], + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ], )) @@ -595,19 +503,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.consumeTimeText, - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['time'] ?? "", - style: TextStyle( - color: HexColor.fromHex("#FF999999"), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), ), ], )), @@ -633,11 +536,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> } else if (modelItem['type'] == '提现') { return Container( margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), - padding: - EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), - decoration: BoxDecoration( - color: HexColor.fromHex("#FFFFFF"), - borderRadius: BorderRadius.circular(8)), + padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), + decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), child: Column( children: <Widget>[ Row( @@ -649,19 +549,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: HexColor.fromHex("#FFFFF3F3"), - border: Border.all( - color: HexColor.fromHex( - outputItemStyle.typeNameColor))), + border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))), child: Padding( - padding: const EdgeInsets.only( - left: 4, right: 4, top: 2, bottom: 2), + padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), child: Center( child: Text( modelItem['type'] ?? "", - style: TextStyle( - color: HexColor.fromHex( - outputItemStyle.typeNameColor), - fontSize: 20.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp), ), ), ), @@ -681,16 +575,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( "- ", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.amountColor)), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)), ), Text( "¥ " + modelItem['amount'], - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.amountColor), - fontSize: 30.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp), ) ], ) @@ -705,44 +594,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.orderIdText, - style: TextStyle( - color: HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['order_id'], - style: TextStyle( - color: HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 28.w, ), GestureDetector( onTap: () { - Clipboard.setData( - ClipboardData(text: modelItem['order_id'])); + Clipboard.setData(ClipboardData(text: modelItem['order_id'])); Fluttertoast.showToast(msg: "已复制"); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), - border: Border.all( - color: HexColor.fromHex( - outputItemStyle.contentColor))), + border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))), child: Padding( - padding: EdgeInsets.only( - left: 16, right: 16, top: 1, bottom: 1), + padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), child: Text( outputItemStyle.copyBtnText ?? "", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ), ), @@ -759,20 +637,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.withdrawAccountText, - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['account'] ?? "", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ], )), @@ -780,13 +652,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> child: Row( children: <Widget>[ Text( - outputItemStyle.withdrawAmountText + - " ¥" + - modelItem['amount'], - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + outputItemStyle.withdrawAmountText + " ¥" + modelItem['amount'], + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ], )) @@ -802,19 +669,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> children: <Widget>[ Text( outputItemStyle.withdrawTimeText, - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), SizedBox( width: 4, ), Text( modelItem['time'] ?? "", - style: TextStyle( - color: HexColor.fromHex("#FF999999"), - fontSize: 22.sp), + style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), ), ], )), @@ -822,14 +684,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> child: Row( children: <Widget>[ Text( - outputItemStyle.withdrawOrderStatusText + - " " + - modelItem['order_status'] ?? - "", - style: TextStyle( - color: - HexColor.fromHex(outputItemStyle.contentColor), - fontSize: 22.sp), + outputItemStyle.withdrawOrderStatusText + " " + modelItem['order_status'] ?? "", + style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), ), ], )) @@ -853,7 +709,6 @@ class _WalletBilDetailState extends State<WalletBilDetail> stream: _bloc.inputOutData, builder: (context, asny) { // dataVM = asny.data; - return Container( child: Column( children: <Widget>[ @@ -869,9 +724,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> onRefresh: () { _bloc.inputRefresh(); }, - child: _bloc.inputDataVM == null - ? Container() - : _buildBottomItem(item)), + child: _bloc.inputDataVM == null ? Container() : _buildBottomItem(item)), ) ], ), @@ -899,9 +752,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> onRefresh: () { _bloc.outputRefresh(); }, - child: _bloc.outputDataVM == null - ? Container() - : _buildBottomItem(item)), + child: _bloc.outputDataVM == null ? Container() : _buildBottomItem(item)), ) ], ),