@@ -35,11 +35,11 @@ class FavoritesBloc extends Bloc<FavoritesEvent, FavoritesState> { | |||||
/// 初始化 | /// 初始化 | ||||
Stream<FavoritesState> _mapInitEventToState(FavoritesInitEvent event) async* { | Stream<FavoritesState> _mapInitEventToState(FavoritesInitEvent event) async* { | ||||
var cache = await repository.fetchCachedStyle(); | var cache = await repository.fetchCachedStyle(event?.model); | ||||
if (!EmptyUtil.isEmpty(cache)) { | if (!EmptyUtil.isEmpty(cache)) { | ||||
yield FavoritesLoadedState(model: cache); | yield FavoritesLoadedState(model: cache); | ||||
} | } | ||||
var result = await repository.fetchNetStyle(); | var result = await repository.fetchNetStyle(event?.model); | ||||
if (!EmptyUtil.isEmpty(result)) { | if (!EmptyUtil.isEmpty(result)) { | ||||
yield FavoritesLoadedState(model: result); | yield FavoritesLoadedState(model: result); | ||||
} else { | } else { | ||||
@@ -4,4 +4,8 @@ part of 'favorites_bloc.dart'; | |||||
abstract class FavoritesEvent {} | abstract class FavoritesEvent {} | ||||
/// 初始化数据 | /// 初始化数据 | ||||
class FavoritesInitEvent extends FavoritesEvent {} | class FavoritesInitEvent extends FavoritesEvent { | ||||
final Map<String, dynamic> model; | |||||
FavoritesInitEvent({this.model}); | |||||
} |
@@ -6,12 +6,14 @@ import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class FavoritesRepository { | class FavoritesRepository { | ||||
/// 请求网络样式 | /// 请求网络样式 | ||||
Future<FavoritesStyleModel> fetchNetStyle() async { | Future<FavoritesStyleModel> fetchNetStyle(final Map<String, dynamic> data) async { | ||||
try { | 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])) { | if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA])) { | ||||
var modListData = result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list'][0]['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)); | 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 { | try { | ||||
var result = await NetUtil.getRequestCachedData('/api/v1/mod/pub.flutter.my_fav'); | String skip_identifier = | ||||
if(!EmptyUtil.isEmpty(result)){ | !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']; | var modListData = result['mod_list'][0]['data']; | ||||
if(!EmptyUtil.isEmpty(modListData)){ | if (!EmptyUtil.isEmpty(modListData)) { | ||||
return FavoritesStyleModel.fromJson(jsonDecode(modListData)); | return FavoritesStyleModel.fromJson(jsonDecode(modListData)); | ||||
} | } | ||||
} | } | ||||
@@ -30,7 +30,7 @@ class FavoritesPage extends StatelessWidget { | |||||
ChangeNotifierProvider.value(value: FavoritesPageNotifier()), | ChangeNotifierProvider.value(value: FavoritesPageNotifier()), | ||||
], | ], | ||||
child: BlocProvider<FavoritesBloc>( | child: BlocProvider<FavoritesBloc>( | ||||
create: (_) => FavoritesBloc(FavoritesRepository())..add(FavoritesInitEvent()), | create: (_) => FavoritesBloc(FavoritesRepository())..add(FavoritesInitEvent(model: data)), | ||||
child: _FavoritesPageContainer(), | child: _FavoritesPageContainer(), | ||||
), | ), | ||||
); | ); | ||||
@@ -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/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/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/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_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'notifier/goods_details_appbar_color_notifier.dart'; | |||||
class GoodsDetailsPage extends StatefulWidget { | class GoodsDetailsPage extends StatefulWidget { | ||||
final Map<String, dynamic> data; | final Map<String, dynamic> data; | ||||
@@ -33,10 +36,10 @@ class _GoodsDetailsPageState extends State<GoodsDetailsPage> { | |||||
providers: [ | providers: [ | ||||
/// 滑动通知 | /// 滑动通知 | ||||
ChangeNotifierProvider.value(value: GoodsDetailsPageNotifier()), | ChangeNotifierProvider.value(value: GoodsDetailsPageNotifier()), | ||||
ChangeNotifierProvider.value(value: GoodsDetailsAppBarColorNotifier()), | |||||
], | ], | ||||
child: BlocProvider<GoodsDetailsPageBloc>( | child: BlocProvider<GoodsDetailsPageBloc>( | ||||
create: (_) => | create: (_) => GoodsDetailsPageBloc(repository: GoodsDetailsPageRepository())..add(GoodsDetailsPageInitEvent(model: widget?.data)), | ||||
GoodsDetailsPageBloc(repository: GoodsDetailsPageRepository())..add(GoodsDetailsPageInitEvent(model: widget?.data)), | |||||
child: GoodsDetailsContainer(widget?.data), | child: GoodsDetailsContainer(widget?.data), | ||||
), | ), | ||||
); | ); | ||||
@@ -54,9 +57,9 @@ class GoodsDetailsContainer extends StatefulWidget { | |||||
class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | ||||
bool _isEnded = false; | bool _isEnded = false; | ||||
ScrollController _controller = ScrollController(); | ScrollController _controller; | ||||
RefreshController _refreshController = | RefreshController _refreshController; | ||||
RefreshController(initialRefresh: false); | final int BANNER_HEIGHT = 375 - 40; | ||||
void _onLoading() async { | void _onLoading() async { | ||||
// await Future.delayed(Duration(milliseconds: 1000)); | // await Future.delayed(Duration(milliseconds: 1000)); | ||||
@@ -71,60 +74,60 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | |||||
Navigator.maybePop(context); | Navigator.maybePop(context); | ||||
} | } | ||||
@override | |||||
void dispose() { | |||||
_controller.dispose(); | |||||
super.dispose(); | |||||
} | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
_refreshController = RefreshController(initialRefresh: false); | |||||
_controller = ScrollController(); | |||||
_controller.addListener(() { | _controller.addListener(() { | ||||
// print('${_controller.offset} ${_controller.position.maxScrollExtent}'); | // print('${_controller.offset} ${_controller.position.maxScrollExtent}'); | ||||
if (_controller.offset >= _controller.position.maxScrollExtent && | if (_controller.offset >= _controller.position.maxScrollExtent && !_isEnded) { | ||||
!_isEnded) { | |||||
// 滑动到底部 | // 滑动到底部 | ||||
_isEnded = true; | _isEnded = true; | ||||
Provider.of<GoodsDetailsPageNotifier>(context, listen: false) | Provider.of<GoodsDetailsPageNotifier>(context, listen: false).loadMore(); | ||||
.loadMore(); | } else if (_controller.offset < _controller.position.maxScrollExtent && _isEnded) { | ||||
} else if (_controller.offset < _controller.position.maxScrollExtent && | |||||
_isEnded) { | |||||
_isEnded = false; | _isEnded = false; | ||||
Provider.of<GoodsDetailsPageNotifier>(context, listen: false).reset(); | 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(); | super.initState(); | ||||
} | } | ||||
@override | |||||
void dispose() { | |||||
_controller?.dispose(); | |||||
_refreshController?.dispose(); | |||||
super.dispose(); | |||||
} | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return MediaQuery.removePadding( | return BlocConsumer<GoodsDetailsPageBloc, GoodsDetailsPageState>( | ||||
removeTop: true, | listener: (BuildContext context, GoodsDetailsPageState state) { | ||||
context: context, | if (state is GoodsDetailsPageErrorState) { | ||||
child: Container( | print('数据加载出错'); | ||||
width: double.infinity, | } | ||||
child: BlocConsumer<GoodsDetailsPageBloc, GoodsDetailsPageState>( | }, | ||||
listener: (BuildContext context, GoodsDetailsPageState state) { | buildWhen: (previous, current) { | ||||
if (state is GoodsDetailsPageErrorState) { | /// 数据加载出错不进行build | ||||
print('数据加载出错'); | if (current is GoodsDetailsPageErrorState) { | ||||
} | return false; | ||||
}, | } | ||||
buildWhen: (previous, current) { | return true; | ||||
/// 数据加载出错不进行build | }, | ||||
if (current is GoodsDetailsPageErrorState) { | builder: (context, state) { | ||||
return false; | print('GoodsDetailsPage currente state = $state'); | ||||
} | if (state is GoodsDetailsPageLoadedState) { | ||||
return true; | return _getMainWidget(state?.model); | ||||
}, | } | ||||
builder: (context, state) { | return GoodsDetailsPageSkeleton(); | ||||
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, | controller: _controller, | ||||
slivers: _createContent(context, datas ?? []), | slivers: _createContent(context, datas ?? []), | ||||
), | ), | ||||
_getAppBarWidget(), | Align(alignment: Alignment.topCenter, child: GoodsDetailsAppBarWidget()), | ||||
], | ], | ||||
)), | )), | ||||
/// appBar | |||||
// Align(alignment: Alignment.topCenter, child: _getAppBarWidget()), | |||||
/// 底部 | /// 底部 | ||||
bottomNavigationBar: GoodsDetailsFooterWidget( | bottomNavigationBar: GoodsDetailsFooterWidget(!EmptyUtil.isEmpty(datas) ? datas[datas.length - 1] : null), | ||||
!EmptyUtil.isEmpty(datas) ? datas[datas.length - 1] : null), | |||||
); | ); | ||||
} | } | ||||
List<Widget> _createContent( | List<Widget> _createContent(BuildContext context, List<Map<String, dynamic>> datas) { | ||||
BuildContext context, List<Map<String, dynamic>> datas) { | |||||
List<Widget> list = List(); | List<Widget> list = List(); | ||||
/// datas.length - 1 为最后一个在底部 | /// datas.length - 1 为最后一个在底部 | ||||
for (int i = 0; i < datas.length - 1; i++) { | for (int i = 0; i < datas.length - 1; i++) { | ||||
WidgetModel item = | WidgetModel item = WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | ||||
WidgetModel.fromJson(Map<String, dynamic>.from(datas[i])); | |||||
print('item.modName ${item.modName}'); | print('item.modName ${item.modName}'); | ||||
list.addAll(WidgetFactory.create( | list.addAll(WidgetFactory.create( | ||||
@@ -186,21 +183,57 @@ class _GoodsDetailsContainerState extends State<GoodsDetailsContainer> { | |||||
Widget _getAppBarWidget() { | Widget _getAppBarWidget() { | ||||
return Container( | return Container( | ||||
width: double.infinity, | width: double.infinity, | ||||
height: 40, | color: HexColor.fromHex('#FF4242'), | ||||
margin: | height: MediaQueryData.fromWindow(window).padding.top + 44, | ||||
EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top), | padding: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top), | ||||
child: AppBar( | child: Row( | ||||
backgroundColor: Colors.transparent, | crossAxisAlignment: CrossAxisAlignment.center, | ||||
elevation: 0, | mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
leading: IconButton( | children: <Widget>[ | ||||
icon: Icon( | Padding( | ||||
Icons.arrow_back_ios, | padding: const EdgeInsets.only(left: 12.5), | ||||
size: 22, | child: SizedBox( | ||||
color: HexColor.fromHex('#FFFFFF'), | 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(), | |||||
// ), | |||||
// ), | |||||
); | ); | ||||
} | } | ||||
} | } |
@@ -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(); | |||||
} | |||||
} | |||||
} |
@@ -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_base_widget/utils/contants.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | import 'package:zhiying_comm/util/base_bloc.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'dart:ui'; | |||||
import 'hot_ranking_page_bloc.dart'; | import 'hot_ranking_page_bloc.dart'; | ||||
@@ -96,7 +97,8 @@ class __HotRankingPageContainerState extends State<_HotRankingPageContainer> { | |||||
return Stack( | return Stack( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
height: 293.h, | height: 146.74 + MediaQueryData.fromWindow(window).padding.top, | ||||
width: double.infinity, | |||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: _bloc.backgroundImage ?? "", fit: BoxFit.fill), | imageUrl: _bloc.backgroundImage ?? "", fit: BoxFit.fill), | ||||
), | ), | ||||
@@ -60,7 +60,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine | |||||
Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'type': styleModel?.type, 'title': styleModel?.name}))); | Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'type': styleModel?.type, 'title': styleModel?.name}))); | ||||
} | } | ||||
/// TODO 需要实现 子widget点击事件,公共跳转 | /// 子item点击的公共跳转 | ||||
void _onItemClick(SkipModel model){ | void _onItemClick(SkipModel model){ | ||||
RouterUtil.route(model, model.toJson(), context); | RouterUtil.route(model, model.toJson(), context); | ||||
} | } | ||||
@@ -593,6 +593,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine | |||||
); | ); | ||||
} | } | ||||
/// 转账自定义widget | |||||
Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { | Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { | ||||
List<Widget> lists = []; | List<Widget> lists = []; | ||||
transactions.forEach((element) { | transactions.forEach((element) { | ||||
@@ -68,11 +68,19 @@ class __VipCenterPageContainerState extends State<_VipCenterPageContainer> { | |||||
if (state is VipCenterInitErrorState) {} | if (state is VipCenterInitErrorState) {} | ||||
/// 加载骨架图 | /// 加载骨架图 | ||||
return Container(); | return _buildSkeletonWidget(); | ||||
}, | }, | ||||
); | ); | ||||
} | } | ||||
/// 骨架图 | |||||
Widget _buildSkeletonWidget(){ | |||||
return Scaffold( | |||||
appBar: _buildAppBarWidget(null), | |||||
body: Container(), | |||||
); | |||||
} | |||||
/// 主视图 | /// 主视图 | ||||
Widget _buildMainWidget(VipCenterStyleModel styleModel) { | Widget _buildMainWidget(VipCenterStyleModel styleModel) { | ||||
return MediaQuery.removePadding( | return MediaQuery.removePadding( | ||||
@@ -157,7 +157,7 @@ class BaseWidgetRegister { | |||||
PageFactory.regist('pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model)); | PageFactory.regist('pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model)); | ||||
/// 消息设置 | /// 消息设置 | ||||
PageFactory.regist('pub.flutter.message_settings', (model) => MessageSettingsPage(model)); | PageFactory.regist('pub.flutter.message_settings', (model) => MessageSettingsPage(model)); | ||||
///钱包明细 | /// 钱包明细 | ||||
PageFactory.regist('pub.flutter.my_bil', (model) => BilDetailPage(model)); | PageFactory.regist('pub.flutter.my_bil', (model) => BilDetailPage(model)); | ||||
} | } | ||||
@@ -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, | |||||
), | |||||
)), | |||||
], | |||||
), | |||||
); | |||||
} | |||||
} |
@@ -1,3 +1,5 @@ | |||||
import 'dart:io'; | |||||
import 'package:flutter/material.dart'; | 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/bloc.dart'; | ||||
import 'package:zhiying_base_widget/widgets/goods_details/coupon/bloc/counpon_repository.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:zhiying_comm/zhiying_comm.dart'; | ||||
import 'package:flutter_bloc/flutter_bloc.dart'; | import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
import 'package:cached_network_image/cached_network_image.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 | /// 优惠券widget | ||||
@@ -20,7 +26,10 @@ class CounponWidget extends StatelessWidget { | |||||
// return Container(); | // return Container(); | ||||
return BlocProvider<CounponBloc>( | return BlocProvider<CounponBloc>( | ||||
create: (_) => CounponBloc(repository: CounponRepository()), //..add(CounponInitEvent(model: model)), | 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> { | class _CounponWidgetContainerState extends State<CounponWidgetContainer> { | ||||
UserInfoModel _user; | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
BlocProvider.of<CounponBloc>(context).add(CounponInitEvent(model: widget?.model)); | BlocProvider.of<CounponBloc>(context).add(CounponInitEvent(model: widget?.model)); | ||||
super.initState(); | 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 | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
@@ -9,21 +9,30 @@ class CounponModel { | |||||
String coupon_url; | String coupon_url; | ||||
String price_type; | String price_type; | ||||
String price_type_color; | String price_type_color; | ||||
String buy_url; | |||||
String provider; | |||||
String goood_id; | |||||
CounponModel( | CounponModel({ | ||||
{this.bg_img, | this.goood_id, | ||||
this.coupon_endtime, | this.provider, | ||||
this.coupon_price, | this.bg_img, | ||||
this.coupon_price_color, | this.coupon_endtime, | ||||
this.coupon_time_color, | this.coupon_price, | ||||
this.coupon_title, | this.coupon_price_color, | ||||
this.coupon_title_color, | this.coupon_time_color, | ||||
this.coupon_url, | this.coupon_title, | ||||
this.price_type, | this.coupon_title_color, | ||||
this.price_type_color}); | this.coupon_url, | ||||
this.price_type, | |||||
this.price_type_color, | |||||
this.buy_url, | |||||
}); | |||||
factory CounponModel.fromJson(Map<String, dynamic> json) { | factory CounponModel.fromJson(Map<String, dynamic> json) { | ||||
return CounponModel( | return CounponModel( | ||||
goood_id: json['goood_id'], | |||||
provider: json['provider'], | |||||
bg_img: json['bg_img'], | bg_img: json['bg_img'], | ||||
coupon_endtime: json['coupon_endtime'], | coupon_endtime: json['coupon_endtime'], | ||||
coupon_price: json['coupon_price'], | coupon_price: json['coupon_price'], | ||||
@@ -34,6 +43,7 @@ class CounponModel { | |||||
coupon_url: json['coupon_url'], | coupon_url: json['coupon_url'], | ||||
price_type: json['price_type'], | price_type: json['price_type'], | ||||
price_type_color: json['price_type_color'], | 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['coupon_url'] = this.coupon_url; | ||||
data['price_type'] = this.price_type; | data['price_type'] = this.price_type; | ||||
data['price_type_color'] = this.price_type_color; | 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; | return data; | ||||
} | } | ||||
} | } |
@@ -63,6 +63,12 @@ class _GooddsDetailsFooterContainerState | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | |||||
void didChangeDependencies() { | |||||
_user = Provider.of<UserInfoNotifier>(context).userInfo; | |||||
super.didChangeDependencies(); | |||||
} | |||||
/// 打开首页 | /// 打开首页 | ||||
void _openHome() { | void _openHome() { | ||||
Navigator.pushAndRemoveUntil( | Navigator.pushAndRemoveUntil( | ||||
@@ -159,7 +165,6 @@ class _GooddsDetailsFooterContainerState | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
_user = Provider.of<UserInfoNotifier>(context).userInfo; | |||||
return BlocConsumer<GoodsDetailsFooterBloc, GoodsDetailsFooterState>( | return BlocConsumer<GoodsDetailsFooterBloc, GoodsDetailsFooterState>( | ||||
listener: (context, state) {}, | listener: (context, state) {}, | ||||
buildWhen: (prev, current) { | buildWhen: (prev, current) { | ||||
@@ -20,8 +20,11 @@ class StoreWidget extends StatelessWidget { | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return BlocProvider<StoreBloc>( | return BlocProvider<StoreBloc>( | ||||
create: (_) => StoreBloc(repository: StoreRepository()),//..add(StoreInitEvent(model: model)), | create: (_) => StoreBloc(repository: StoreRepository()), //..add(StoreInitEvent(model: model)), | ||||
child: StoreContainer(model, key: UniqueKey(),), | child: StoreContainer( | ||||
model, | |||||
key: UniqueKey(), | |||||
), | |||||
); | ); | ||||
} | } | ||||
} | } | ||||
@@ -36,7 +39,6 @@ class StoreContainer extends StatefulWidget { | |||||
} | } | ||||
class _StoreContainerState extends State<StoreContainer> { | class _StoreContainerState extends State<StoreContainer> { | ||||
@override | @override | ||||
void initState() { | void initState() { | ||||
BlocProvider.of<StoreBloc>(context).add(StoreInitEvent(model: widget?.model)); | BlocProvider.of<StoreBloc>(context).add(StoreInitEvent(model: widget?.model)); | ||||
@@ -105,7 +107,7 @@ class _StoreContainerState extends State<StoreContainer> { | |||||
height: 50, | height: 50, | ||||
// color: Colors.red, | // color: Colors.red, | ||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: model?.shop_avatar?? '', | imageUrl: model?.shop_avatar ?? '', | ||||
fit: BoxFit.fill, | 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?.shop_name ?? '品胜京东自营旗舰店', style: TextStyle(color: HexColor.fromHex(model?.shop_name_color ?? '#333333'), fontSize: 13, fontWeight: FontWeight.bold)), | ||||
/// 更多 | /// 更多 TODO 暂时隐藏,等后台有数据后再打开 | ||||
Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11)), | 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, | mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
/// 宝贝描述 5.0 | /// 宝贝描述 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 | /// 物流服务 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 | /// 服务态度 1.0 | ||||
_getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''), | _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, | // color: Colors.red, | ||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: icon ?? '', | imageUrl: icon ?? '', | ||||
), | ), | ||||
), | ), | ||||
], | ], | ||||
@@ -12,31 +12,25 @@ class HotRankingGoods extends StatelessWidget { | |||||
HotRankingListModel styleModel; | HotRankingListModel styleModel; | ||||
int index; | int index; | ||||
HotRankingGoods({Key key, this.good, this.styleModel, this.index}) | HotRankingGoods({Key key, this.good, this.styleModel, this.index}) : super(key: key); | ||||
: super(key: key); | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
var indexImage; | var indexImage; | ||||
if (styleModel.hotRankIconList != null && | if (styleModel.hotRankIconList != null && styleModel.hotRankIconList.length > 0 && styleModel.hotRankIconList.length - 1 >= index) { | ||||
styleModel.hotRankIconList.length > 0 && | |||||
styleModel.hotRankIconList.length - 1 >= index) { | |||||
indexImage = styleModel.hotRankIconList[index]; | indexImage = styleModel.hotRankIconList[index]; | ||||
} | } | ||||
Providers providers = getProvider(good.provider); | Providers providers = getProvider(good.provider); | ||||
return GestureDetector( | return GestureDetector( | ||||
onTap: () { | onTap: () { | ||||
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), | RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), good?.toJson(), context); | ||||
good?.toJson(), context); | |||||
}, | }, | ||||
child: Stack( | child: Stack( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
padding: EdgeInsets.all(15.w), | padding: EdgeInsets.all(15.w), | ||||
margin: | margin: EdgeInsets.only(top: 8.w, bottom: 8.w, left: 25.w, right: 25.w), | ||||
EdgeInsets.only(top: 8.w, bottom: 8.w, left: 25.w, right: 25.w), | decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15.w)), | ||||
decoration: BoxDecoration( | |||||
color: Colors.white, borderRadius: BorderRadius.circular(15.w)), | |||||
child: Row( | child: Row( | ||||
crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
@@ -50,9 +44,9 @@ class HotRankingGoods extends StatelessWidget { | |||||
imageUrl: good?.goodImage ?? '', | imageUrl: good?.goodImage ?? '', | ||||
), | ), | ||||
), | ), | ||||
decoration: | decoration: BoxDecoration(borderRadius: BorderRadius.circular(6)), | ||||
BoxDecoration(borderRadius: BorderRadius.circular(6)), | |||||
), | ), | ||||
/// 商品图片右边视图 | /// 商品图片右边视图 | ||||
Expanded( | Expanded( | ||||
child: Container( | child: Container( | ||||
@@ -70,16 +64,8 @@ class HotRankingGoods extends StatelessWidget { | |||||
WidgetSpan( | WidgetSpan( | ||||
alignment: ui.PlaceholderAlignment.middle, | alignment: ui.PlaceholderAlignment.middle, | ||||
child: Container( | child: Container( | ||||
padding: EdgeInsets.only( | padding: EdgeInsets.only(left: 4.w, right: 4.w, top: 1, bottom: 1), | ||||
left: 4.w, | decoration: BoxDecoration(color: HexColor.fromHex(providers.providerBgColor), borderRadius: BorderRadius.circular(2.5)), | ||||
right: 4.w, | |||||
top: 1, | |||||
bottom: 1), | |||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex( | |||||
providers.providerBgColor), | |||||
borderRadius: | |||||
BorderRadius.circular(2.5)), | |||||
child: Text( | child: Text( | ||||
good.providerName ?? "", | good.providerName ?? "", | ||||
style: TextStyle( | style: TextStyle( | ||||
@@ -93,12 +79,7 @@ class HotRankingGoods extends StatelessWidget { | |||||
child: SizedBox( | child: SizedBox( | ||||
width: 4.h, | width: 4.h, | ||||
)), | )), | ||||
TextSpan( | TextSpan(text: good.goodTitle, style: TextStyle(color: HexColor.fromHex(styleModel.titleColor ?? ""), fontSize: 30.sp)) | ||||
text: good.goodTitle, | |||||
style: TextStyle( | |||||
color: HexColor.fromHex( | |||||
styleModel.titleColor ?? ""), | |||||
fontSize: 30.sp)) | |||||
])), | ])), | ||||
/// 优惠券 | /// 优惠券 | ||||
@@ -107,29 +88,16 @@ class HotRankingGoods extends StatelessWidget { | |||||
good.coupon == "" | good.coupon == "" | ||||
? Container() | ? Container() | ||||
: Container( | : Container( | ||||
margin: EdgeInsets.only( | margin: EdgeInsets.only(top: 4, bottom: 4, right: 15.w), | ||||
top: 4, bottom: 4, right: 15.w), | |||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
color: HexColor.fromHex(styleModel | borderRadius: BorderRadius.circular(2.5), | ||||
.couponCommission.left.couponBgColor), | color: HexColor.fromHex(styleModel.couponCommission.left.couponBgColor), | ||||
image: DecorationImage( | image: DecorationImage(image: CachedNetworkImageProvider(styleModel.couponCommission.left.couponBgImg))), | ||||
image: CachedNetworkImageProvider( | |||||
styleModel.couponCommission.left | |||||
.couponBgImg))), | |||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only( | padding: const EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), | ||||
left: 8, right: 8, top: 2, bottom: 2), | |||||
child: Text( | child: Text( | ||||
(good.coupon ?? "") + | (good.coupon ?? "") + (styleModel.couponCommission.left.couonText ?? ""), | ||||
(styleModel.couponCommission.left | style: TextStyle(color: HexColor.fromHex(styleModel.couponCommission.left.couponFontColor), fontSize: 22.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
.couonText ?? | |||||
""), | |||||
style: TextStyle( | |||||
color: HexColor.fromHex(styleModel | |||||
.couponCommission | |||||
.left | |||||
.couponFontColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -138,30 +106,14 @@ class HotRankingGoods extends StatelessWidget { | |||||
: Container( | : Container( | ||||
margin: EdgeInsets.only(top: 4, bottom: 4), | margin: EdgeInsets.only(top: 4, bottom: 4), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
color: HexColor.fromHex(styleModel | borderRadius: BorderRadius.circular(2.5), | ||||
.couponCommission | color: HexColor.fromHex(styleModel.couponCommission.right.commissionBgColor ?? ""), | ||||
.right | image: DecorationImage(image: CachedNetworkImageProvider(styleModel.couponCommission.right.commissionBgImg ?? ""))), | ||||
.commissionBgColor ?? | |||||
""), | |||||
image: DecorationImage( | |||||
image: CachedNetworkImageProvider( | |||||
styleModel.couponCommission.right | |||||
.commissionBgImg ?? | |||||
""))), | |||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only( | padding: const EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), | ||||
left: 8, right: 8, top: 2, bottom: 2), | |||||
child: Text( | child: Text( | ||||
(styleModel.couponCommission.right | (styleModel.couponCommission.right.commissionText ?? "") + (good.commission ?? ""), | ||||
.commissionText ?? | style: TextStyle(color: HexColor.fromHex(styleModel.couponCommission.right.commissionFontColor), fontSize: 22.sp,fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
"") + | |||||
(good.commission ?? ""), | |||||
style: TextStyle( | |||||
color: HexColor.fromHex(styleModel | |||||
.couponCommission | |||||
.right | |||||
.commissionFontColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -178,18 +130,12 @@ class HotRankingGoods extends StatelessWidget { | |||||
padding: EdgeInsets.only(bottom: 6.sp), | padding: EdgeInsets.only(bottom: 6.sp), | ||||
child: Text( | child: Text( | ||||
"¥", | "¥", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(styleModel.currentPriceColor ?? ""), fontSize: 20.sp), | ||||
color: HexColor.fromHex( | |||||
styleModel.currentPriceColor ?? ""), | |||||
fontSize: 20.sp), | |||||
), | ), | ||||
), | ), | ||||
Text( | Text( | ||||
good.currentPrice ?? "", | good.currentPrice ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(styleModel.currentPriceColor ?? ""), fontSize: 40.sp,fontWeight: FontWeight.bold ,fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
color: HexColor.fromHex( | |||||
styleModel.currentPriceColor ?? ""), | |||||
fontSize: 40.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 6, | width: 6, | ||||
@@ -198,11 +144,7 @@ class HotRankingGoods extends StatelessWidget { | |||||
padding: EdgeInsets.only(bottom: 4.sp), | padding: EdgeInsets.only(bottom: 4.sp), | ||||
child: Text( | child: Text( | ||||
"¥" + good.marketPrice ?? "", | "¥" + good.marketPrice ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(styleModel.marketPriceColor ?? ""), fontSize: 22.sp, decoration: TextDecoration.lineThrough, fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
color: HexColor.fromHex( | |||||
styleModel.marketPriceColor ?? ""), | |||||
fontSize: 22.sp, | |||||
decoration: TextDecoration.lineThrough), | |||||
), | ), | ||||
), | ), | ||||
], | ], | ||||
@@ -225,14 +167,11 @@ class HotRankingGoods extends StatelessWidget { | |||||
padding: EdgeInsets.only( | padding: EdgeInsets.only( | ||||
left: 40.w, | left: 40.w, | ||||
), | ), | ||||
margin: | margin: EdgeInsets.only(right: 20, left: 20.w), | ||||
EdgeInsets.only(right: 20, left: 20.w), | color: HexColor.fromHex(styleModel.hotRank.bgColor ?? ""), | ||||
color: HexColor.fromHex( | |||||
styleModel.hotRank.bgColor ?? ""), | |||||
child: Text( | child: Text( | ||||
"热销" + good.inorderCount + "件", | "热销" + good.inorderCount + "件", | ||||
style: TextStyle( | style: TextStyle(color: Colors.white, fontSize: 22.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
color: Colors.white, fontSize: 22.sp), | |||||
), | ), | ||||
)) | )) | ||||
], | ], | ||||
@@ -241,12 +180,10 @@ class HotRankingGoods extends StatelessWidget { | |||||
width: 48.w, | width: 48.w, | ||||
height: 48.w, | height: 48.w, | ||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: | imageUrl: styleModel?.hotRank?.hotSaleImg ?? "", | ||||
styleModel?.hotRank?.hotSaleImg ?? "", | |||||
width: 48.w, | width: 48.w, | ||||
height: 48.w, | height: 48.w, | ||||
placeholder: (context, _) => | placeholder: (context, _) => Container(color: Colors.yellow), | ||||
Container(color: Colors.yellow), | |||||
fit: BoxFit.fill, | fit: BoxFit.fill, | ||||
), | ), | ||||
), | ), | ||||
@@ -256,13 +193,8 @@ class HotRankingGoods extends StatelessWidget { | |||||
height: 48.h, | height: 48.h, | ||||
width: 127.w, | width: 127.w, | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
image: DecorationImage( | image: DecorationImage(image: CachedNetworkImageProvider(styleModel.hotRank.buyNowImg ?? ""), fit: BoxFit.fitWidth), | ||||
image: CachedNetworkImageProvider( | borderRadius: BorderRadius.circular(20)), | ||||
styleModel.hotRank.buyNowImg ?? | |||||
""), | |||||
fit: BoxFit.fitWidth), | |||||
borderRadius: | |||||
BorderRadius.circular(20)), | |||||
margin: EdgeInsets.only(right: 0), | margin: EdgeInsets.only(right: 0), | ||||
)) | )) | ||||
], | ], | ||||
@@ -278,9 +210,7 @@ class HotRankingGoods extends StatelessWidget { | |||||
Align( | Align( | ||||
alignment: Alignment.topLeft, | alignment: Alignment.topLeft, | ||||
child: Container( | child: Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(indexImage ?? ""))), | ||||
image: DecorationImage( | |||||
image: CachedNetworkImageProvider(indexImage ?? ""))), | |||||
margin: EdgeInsets.only(left: 40.w, top: 8.h), | margin: EdgeInsets.only(left: 40.w, top: 8.h), | ||||
height: 60.w, | height: 60.w, | ||||
width: 60.w, | width: 60.w, | ||||
@@ -2,6 +2,7 @@ import 'dart:async'; | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'package:flutter/material.dart'; | 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_base_widget/pages/hot_ranking_page/hot_ranking_page_bloc.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | import 'package:zhiying_comm/util/base_bloc.dart'; | ||||
import 'package:zhiying_comm/util/extension/color.dart'; | import 'package:zhiying_comm/util/extension/color.dart'; | ||||
@@ -54,7 +55,9 @@ class _HotRankTableBarState extends State<HotRankTableBar> | |||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(bottom: 10), | margin: EdgeInsets.only(bottom: 10), | ||||
child: TabBar( | child: TabBar( | ||||
indicatorPadding: EdgeInsets.only(bottom: 0), | // indicatorPadding: EdgeInsets.only(bottom: 0, top: 10), | ||||
// indicatorWeight: 3, | |||||
indicatorWeight: 6, | |||||
indicatorSize: TabBarIndicatorSize.label, | indicatorSize: TabBarIndicatorSize.label, | ||||
controller: _tabController, | controller: _tabController, | ||||
indicatorColor: HexColor.fromHex( | indicatorColor: HexColor.fromHex( | ||||
@@ -63,6 +66,15 @@ class _HotRankTableBarState extends State<HotRankTableBar> | |||||
_barModel.tabList[_tabController.index].nameNoSelectColor), | _barModel.tabList[_tabController.index].nameNoSelectColor), | ||||
labelColor: HexColor.fromHex( | labelColor: HexColor.fromHex( | ||||
_barModel.tabList[_tabController.index].nameSelectColor), | _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, | isScrollable: true, | ||||
tabs: _buildTabs(), | tabs: _buildTabs(), | ||||
onTap: (index) { | onTap: (index) { | ||||
@@ -1,9 +1,10 @@ | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'package:flutter/material.dart'; | 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 'package:zhiying_comm/zhiying_comm.dart'; | ||||
import 'model/wallet_appbar_model.dart'; | |||||
class WalletAppbar extends StatelessWidget { | class WalletAppbar extends StatelessWidget { | ||||
final Map<String, dynamic> data; | final Map<String, dynamic> data; | ||||
@@ -2,6 +2,7 @@ import 'dart:convert'; | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.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/dialog/tip_dialog/tip_dialog.dart'; | ||||
import 'package:zhiying_base_widget/pages/withdraw_page/withdraw_page.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'; | 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(); | _WalletDetailState createState() => _WalletDetailState(); | ||||
} | } | ||||
class _WalletDetailState extends State<WalletDetail> | class _WalletDetailState extends State<WalletDetail> with TickerProviderStateMixin { | ||||
with TickerProviderStateMixin { | |||||
WalletDetailModel _model; | WalletDetailModel _model; | ||||
TabController _tabController; | TabController _tabController; | ||||
@@ -37,8 +37,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
void initState() { | void initState() { | ||||
if (widget.data != null) { | if (widget.data != null) { | ||||
_model = WalletDetailModel.fromJson(json.decode(widget.data['data'])); | _model = WalletDetailModel.fromJson(json.decode(widget.data['data'])); | ||||
_tabController = | _tabController = TabController(length: _model.providers.length, vsync: this); | ||||
TabController(length: _model.providers.length, vsync: this); | |||||
} | } | ||||
_bloc = new WalletDetailBloc(); | _bloc = new WalletDetailBloc(); | ||||
_bloc.loadData(_model.providers[0].type); | _bloc.loadData(_model.providers[0].type); | ||||
@@ -55,23 +54,29 @@ class _WalletDetailState extends State<WalletDetail> | |||||
return WalletDetailSkeleton(); | return WalletDetailSkeleton(); | ||||
} | } | ||||
return Container( | return Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), | ||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 15.h, bottom: 15.h), | ||||
margin: | padding: const EdgeInsets.only(bottom: 13), | ||||
EdgeInsets.only(left: 12.5, right: 12.5, top: 15.h, bottom: 15.h), | |||||
padding: EdgeInsets.only(bottom: 15.h), | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
padding: EdgeInsets.only(top: 12), | |||||
child: TabBar( | 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, | isScrollable: true, | ||||
unselectedLabelColor: | unselectedLabelColor: HexColor.fromHex(_model.providers[0].unselectColor), | ||||
HexColor.fromHex(_model.providers[0].unselectColor), | labelColor: HexColor.fromHex(_model.providers[0].selectColor), | ||||
labelColor: | |||||
HexColor.fromHex(_model.providers[0].selectColor), | |||||
controller: _tabController, | controller: _tabController, | ||||
indicatorColor: | indicatorColor: HexColor.fromHex(_model.providers[0].selectColor), | ||||
HexColor.fromHex(_model.providers[0].selectColor), | |||||
indicatorSize: TabBarIndicatorSize.label, | indicatorSize: TabBarIndicatorSize.label, | ||||
onTap: (index) { | onTap: (index) { | ||||
///变更平台 | ///变更平台 | ||||
@@ -83,21 +88,21 @@ class _WalletDetailState extends State<WalletDetail> | |||||
///日期选择 | ///日期选择 | ||||
Container( | Container( | ||||
height: 100.h, | height: 100.h, | ||||
alignment: Alignment.center, | |||||
child: ListView.builder( | child: ListView.builder( | ||||
padding: EdgeInsets.only(top: 16,left: 16.w), | padding: EdgeInsets.only( left: 16.w), | ||||
itemCount: _model.dateList.length, | itemCount: _model.dateList.length, | ||||
scrollDirection: Axis.horizontal, | scrollDirection: Axis.horizontal, | ||||
itemBuilder: _buildTimeItem), | itemBuilder: _buildTimeItem, | ||||
), | |||||
), | ), | ||||
/// 数据 | |||||
Container( | Container( | ||||
height: 126.h, | height: 126.h, | ||||
margin: EdgeInsets.only(top: 16, left: 30.w, right: 30.w), | margin: EdgeInsets.only(top: 16, left: 30.w, right: 30.w), | ||||
width: double.infinity, | width: double.infinity, | ||||
decoration: BoxDecoration( | decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(_model.providerDashbord.finish.bgImg), fit: BoxFit.fill)), | ||||
image: DecorationImage( | |||||
image: CachedNetworkImageProvider( | |||||
_model.providerDashbord.finish.bgImg), | |||||
fit: BoxFit.fill)), | |||||
child: Column( | child: Column( | ||||
mainAxisAlignment: MainAxisAlignment.center, | mainAxisAlignment: MainAxisAlignment.center, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
@@ -107,10 +112,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
padding: const EdgeInsets.all(8.0), | padding: const EdgeInsets.all(8.0), | ||||
child: Text( | child: Text( | ||||
_model.providerDashbord.finish.text, | _model.providerDashbord.finish.text, | ||||
style: TextStyle( | style: TextStyle(fontSize: 28.sp, color: HexColor.fromHex(_model.providerDashbord.finish.textColor)), | ||||
fontSize: 28.sp, | |||||
color: HexColor.fromHex(_model | |||||
.providerDashbord.finish.textColor)), | |||||
), | ), | ||||
), | ), | ||||
Row( | Row( | ||||
@@ -118,16 +120,13 @@ class _WalletDetailState extends State<WalletDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
_model.providerDashbord.finish.text ?? "", | _model.providerDashbord.finish.text ?? "", | ||||
style: | style: TextStyle(color: Colors.black, fontSize: 22.sp), | ||||
TextStyle(color: Colors.black, fontSize: 22.sp), | |||||
), | ), | ||||
InkWell( | InkWell( | ||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.all(8.0), | padding: const EdgeInsets.all(8.0), | ||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: | imageUrl: _model.providerDashbord.finish.tipIcon ?? "", | ||||
_model.providerDashbord.finish.tipIcon ?? | |||||
"", | |||||
width: 20.h, | width: 20.h, | ||||
height: 20.h, | height: 20.h, | ||||
fit: BoxFit.fill, | fit: BoxFit.fill, | ||||
@@ -135,14 +134,13 @@ class _WalletDetailState extends State<WalletDetail> | |||||
), | ), | ||||
onTap: () { | onTap: () { | ||||
///显示弹窗 | ///显示弹窗 | ||||
showTipDialog( | showTipDialog(null, _model.providerDashbord.finish.tipText); | ||||
null, _model.providerDashbord.finish.tipText); | |||||
}) | }) | ||||
], | ], | ||||
), | ), | ||||
Text( | Text( | ||||
_bloc.selectDateData.finish ?? "", | _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, | shrinkWrap: true, | ||||
physics: NeverScrollableScrollPhysics(), | physics: NeverScrollableScrollPhysics(), | ||||
itemBuilder: (context, index) { | itemBuilder: (context, index) { | ||||
return _buildBottomItem( | return _buildBottomItem(context, index, _model.providerDashbord); | ||||
context, index, _model.providerDashbord); | |||||
}), | }), | ||||
) | ) | ||||
], | ], | ||||
@@ -169,11 +166,9 @@ class _WalletDetailState extends State<WalletDetail> | |||||
_buildTabs() { | _buildTabs() { | ||||
List<Widget> listWidget = List(); | List<Widget> listWidget = List(); | ||||
for (var item in _model.providers) { | for (var item in _model.providers) { | ||||
listWidget.add(Tab( | listWidget.add(Text( | ||||
child: Text( | item.name, | ||||
item.name, | style: TextStyle(fontSize: 14, ), | ||||
style: TextStyle(fontSize: 28.sp), | |||||
), | |||||
)); | )); | ||||
} | } | ||||
return listWidget; | return listWidget; | ||||
@@ -185,23 +180,14 @@ class _WalletDetailState extends State<WalletDetail> | |||||
child: Container( | child: Container( | ||||
margin: EdgeInsets.only(top: 0, left: 8, right: 8), | margin: EdgeInsets.only(top: 0, left: 8, right: 8), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
image: DecorationImage( | image: DecorationImage(image: CachedNetworkImageProvider(item.type == _bloc.selectDateData.type ? item.btnImg ?? "" : item.btnNoColorImg ?? ""), fit: BoxFit.fitWidth), | ||||
image: CachedNetworkImageProvider( | |||||
item.type == _bloc.selectDateData.type | |||||
? item.btnImg ?? "" | |||||
: item.btnNoColorImg ?? ""), | |||||
fit: BoxFit.fitWidth), | |||||
), | ), | ||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only(left: 16, right: 16), | padding: const EdgeInsets.only(left: 16, right: 16), | ||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
item.text, | item.text, | ||||
style: TextStyle( | style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.type == _bloc.selectDateData.type ? item.textSelectColor : item.textUnselectColor)), | ||||
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( | Widget _buildBottomItem(BuildContext context, int index, ProviderDashbord dashbord) { | ||||
BuildContext context, int index, ProviderDashbord dashbord) { | |||||
SelfBuy item; | SelfBuy item; | ||||
if (index == 0) { | if (index == 0) { | ||||
item = dashbord.selfBuy; | item = dashbord.selfBuy; | ||||
@@ -241,9 +226,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
? Container() | ? Container() | ||||
: Text( | : Text( | ||||
item.title, | item.title, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(item.titleColor), fontSize: 28.sp), | ||||
color: HexColor.fromHex(item.titleColor), | |||||
fontSize: 28.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
height: 15.h, | height: 15.h, | ||||
@@ -256,11 +239,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
height: 123.h, | height: 123.h, | ||||
margin: EdgeInsets.only(right: 8, left: 30.w), | margin: EdgeInsets.only(right: 8, left: 30.w), | ||||
padding: EdgeInsets.only(left: 20.w), | padding: EdgeInsets.only(left: 20.w), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[0].bgImg ?? ""), fit: BoxFit.fill)), | ||||
image: DecorationImage( | |||||
image: CachedNetworkImageProvider( | |||||
item.itemList[0].bgImg ?? ""), | |||||
fit: BoxFit.fill)), | |||||
child: Column( | child: Column( | ||||
mainAxisAlignment: MainAxisAlignment.center, | mainAxisAlignment: MainAxisAlignment.center, | ||||
crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
@@ -269,10 +248,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
item.itemList[0].text ?? "", | item.itemList[0].text ?? "", | ||||
style: TextStyle( | style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.itemList[0].textColor)), | ||||
fontSize: 22.sp, | |||||
color: HexColor.fromHex( | |||||
item.itemList[0].textColor)), | |||||
), | ), | ||||
InkWell( | InkWell( | ||||
child: Padding( | child: Padding( | ||||
@@ -293,9 +269,11 @@ class _WalletDetailState extends State<WalletDetail> | |||||
), | ), | ||||
Text(dataMap[item.itemList[0].vauleKey], | Text(dataMap[item.itemList[0].vauleKey], | ||||
style: TextStyle( | style: TextStyle( | ||||
fontFamily: 'Din', | |||||
package: 'zhiying_base_widget', | |||||
fontWeight: FontWeight.bold, | |||||
fontSize: 34.sp, | fontSize: 34.sp, | ||||
color: | color: HexColor.fromHex(item.itemList[1].valueColor), | ||||
HexColor.fromHex(item.itemList[1].valueColor), | |||||
)) | )) | ||||
], | ], | ||||
)), | )), | ||||
@@ -305,11 +283,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
height: 123.h, | height: 123.h, | ||||
margin: EdgeInsets.only(left: 8, right: 30.w), | margin: EdgeInsets.only(left: 8, right: 30.w), | ||||
padding: EdgeInsets.only(left: 20.w), | padding: EdgeInsets.only(left: 20.w), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration(image: DecorationImage(image: CachedNetworkImageProvider(item.itemList[1].bgImg ?? ""), fit: BoxFit.fill)), | ||||
image: DecorationImage( | |||||
image: CachedNetworkImageProvider( | |||||
item.itemList[1].bgImg ?? ""), | |||||
fit: BoxFit.fill)), | |||||
child: Column( | child: Column( | ||||
mainAxisAlignment: MainAxisAlignment.center, | mainAxisAlignment: MainAxisAlignment.center, | ||||
crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
@@ -318,10 +292,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
item.itemList[1].text ?? "", | item.itemList[1].text ?? "", | ||||
style: TextStyle( | style: TextStyle(fontSize: 22.sp, color: HexColor.fromHex(item.itemList[1].textColor)), | ||||
fontSize: 22.sp, | |||||
color: | |||||
HexColor.fromHex(item.itemList[1].textColor)), | |||||
), | ), | ||||
InkWell( | InkWell( | ||||
child: Padding( | child: Padding( | ||||
@@ -343,8 +314,7 @@ class _WalletDetailState extends State<WalletDetail> | |||||
Text( | Text( | ||||
dataMap[item.itemList[1].vauleKey], | dataMap[item.itemList[1].vauleKey], | ||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 34.sp, | fontSize: 34.sp, color: HexColor.fromHex(item.itemList[1].valueColor), fontFamily: 'Din', package: 'zhiying_base_widget', fontWeight: FontWeight.bold), | ||||
color: HexColor.fromHex(item.itemList[1].valueColor)), | |||||
) | ) | ||||
], | ], | ||||
), | ), | ||||
@@ -4,11 +4,13 @@ import 'package:flutter/material.dart'; | |||||
import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
import 'package:intl/intl.dart'; | import 'package:intl/intl.dart'; | ||||
import 'package:pull_to_refresh/pull_to_refresh.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/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/wallet_detail/wallet_detail_bloc.dart'; | ||||
import 'package:zhiying_base_widget/widgets/wallet_bil_detail/wallet_bil_detail_widget_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/base_bloc.dart'; | ||||
import 'package:zhiying_comm/util/extension/color.dart'; | import 'package:zhiying_comm/util/extension/color.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||||
import 'model/wallet_style_model.dart'; | import 'model/wallet_style_model.dart'; | ||||
@@ -24,8 +26,7 @@ class WalletBilDetail extends StatefulWidget { | |||||
_WalletBilDetailState createState() => _WalletBilDetailState(); | _WalletBilDetailState createState() => _WalletBilDetailState(); | ||||
} | } | ||||
class _WalletBilDetailState extends State<WalletBilDetail> | class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { | ||||
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { | |||||
WalletBilDetailWidgetBloc _bloc; | WalletBilDetailWidgetBloc _bloc; | ||||
TabController _tabController; | TabController _tabController; | ||||
@@ -34,8 +35,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
void initState() { | void initState() { | ||||
_bloc = WalletBilDetailWidgetBloc(); | _bloc = WalletBilDetailWidgetBloc(); | ||||
_bloc.initStyleData(json.decode(widget.data['data'])); | _bloc.initStyleData(json.decode(widget.data['data'])); | ||||
_tabController = | _tabController = TabController(length: _bloc.styleData.tabList.length, vsync: this); | ||||
TabController(length: _bloc.styleData.tabList.length, vsync: this); | |||||
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); | _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); | ||||
_bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate); | _bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate); | ||||
@@ -51,8 +51,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
AppBar( | AppBar( | ||||
brightness: Brightness.light, | brightness: Brightness.light, | ||||
backgroundColor: | backgroundColor: HexColor.fromHex(_bloc.styleData.appBarBgColor), | ||||
HexColor.fromHex(_bloc.styleData.appBarBgColor), | |||||
centerTitle: true, | centerTitle: true, | ||||
leading: IconButton( | leading: IconButton( | ||||
icon: Icon( | icon: Icon( | ||||
@@ -65,29 +64,32 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
}), | }), | ||||
title: Text( | title: Text( | ||||
_bloc.styleData.appBarName ?? "", | _bloc.styleData.appBarName ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(_bloc.styleData.appBarNameColor), fontWeight: FontWeight.bold, fontSize: 18), | ||||
color: HexColor.fromHex(_bloc.styleData.appBarNameColor)), | |||||
), | ), | ||||
), | ), | ||||
Container( | Container( | ||||
color: Colors.white, | color: Colors.white, | ||||
child: TabBar( | 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, | controller: _tabController, | ||||
tabs: _buildTabBarItem(), | tabs: _buildTabBarItem(), | ||||
indicatorWeight: 3, | indicatorWeight: 9.5, | ||||
labelStyle: TextStyle(fontSize: 30.sp), | labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), | ||||
unselectedLabelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), | |||||
labelColor: HexColor.fromHex(_bloc.styleData.tabSeletedColor), | labelColor: HexColor.fromHex(_bloc.styleData.tabSeletedColor), | ||||
unselectedLabelColor: | unselectedLabelColor: HexColor.fromHex(_bloc.styleData.tabNoSeletedColor), | ||||
HexColor.fromHex(_bloc.styleData.tabNoSeletedColor), | indicatorColor: HexColor.fromHex(_bloc.styleData.tabLineColor), | ||||
indicatorColor: | |||||
HexColor.fromHex(_bloc.styleData.tabLineColor), | |||||
indicatorSize: TabBarIndicatorSize.label, | indicatorSize: TabBarIndicatorSize.label, | ||||
), | ), | ||||
), | ), | ||||
Expanded( | Expanded(child: TabBarView(controller: _tabController, children: _buildTabViewPage())) | ||||
child: TabBarView( | |||||
controller: _tabController, | |||||
children: _buildTabViewPage())) | |||||
], | ], | ||||
), | ), | ||||
)); | )); | ||||
@@ -97,9 +99,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
_buildTabBarItem() { | _buildTabBarItem() { | ||||
List<Widget> listWidget = List(); | List<Widget> listWidget = List(); | ||||
for (var item in _bloc.styleData.tabList) { | for (var item in _bloc.styleData.tabList) { | ||||
listWidget.add(Tab( | listWidget.add(Text( | ||||
text: item.name ?? "", | item.name ?? "", | ||||
)); | ) | ||||
// Tab(text: item.name ?? ""), | |||||
); | |||||
} | } | ||||
return listWidget; | return listWidget; | ||||
} | } | ||||
@@ -110,7 +114,6 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
selectType = _bloc.inputSelectType; | selectType = _bloc.inputSelectType; | ||||
} else { | } else { | ||||
selectType = _bloc.outputSelectType; | selectType = _bloc.outputSelectType; | ||||
; | |||||
} | } | ||||
return Row( | return Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
@@ -122,14 +125,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
}, | }, | ||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only(top: 8, bottom: 8), | padding: const EdgeInsets.only(top: 8, bottom: 8), | ||||
child: Text( | child: Text(tabList.type == "input" ? _bloc.inputShowDate : _bloc.outputShowDate, | ||||
tabList.type == "input" | style: TextStyle(fontSize: 28.sp, color: HexColor.fromHex(_bloc.styleData.timeSelectColor), fontWeight: FontWeight.bold))), | ||||
? _bloc.inputShowDate | |||||
: _bloc.outputShowDate, | |||||
style: TextStyle( | |||||
fontSize: 28.sp, | |||||
color: | |||||
HexColor.fromHex(_bloc.styleData.timeSelectColor)))), | |||||
), | ), | ||||
Icon( | Icon( | ||||
Icons.arrow_drop_down, | Icons.arrow_drop_down, | ||||
@@ -137,53 +134,43 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
), | ), | ||||
Expanded( | Expanded( | ||||
child: Container( | child: Container( | ||||
height: 50, | margin: const EdgeInsets.only(top: 15, bottom: 15, left: 12.5), | ||||
height: 25, | |||||
child: ListView.builder( | child: ListView.builder( | ||||
scrollDirection: Axis.horizontal, | scrollDirection: Axis.horizontal, | ||||
shrinkWrap: true, | shrinkWrap: true, | ||||
itemCount: tabViewBtns.length, | itemCount: tabViewBtns.length, | ||||
itemBuilder: (context, index) { | itemBuilder: (context, index) { | ||||
return InkWell( | return GestureDetector( | ||||
onTap: () async { | onTap: () async { | ||||
if (tabList.type == 'input') { | if (tabList.type == 'input') { | ||||
_bloc.inputSelectType = tabViewBtns[index].type; | _bloc.inputSelectType = tabViewBtns[index].type; | ||||
_bloc.inPutCurrentPage=1; | _bloc.inPutCurrentPage = 1; | ||||
_bloc.loadInputData( | _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate, type: _bloc.inputSelectType); | ||||
_bloc.inPutCurrentPage, _bloc.inputShowDate, | } else { | ||||
type: _bloc.inputSelectType); | _bloc.outputSelectType = tabViewBtns[index].type; | ||||
} else { | _bloc.outPutCurrentPage = 1; | ||||
_bloc.outputSelectType = tabViewBtns[index].type; | _bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate, type: _bloc.outputSelectType); | ||||
_bloc.outPutCurrentPage=1; | } | ||||
_bloc.loadOutputData( | _bloc.refresh(); | ||||
_bloc.outPutCurrentPage, _bloc.outputShowDate, | }, | ||||
type: _bloc.outputSelectType); | behavior: HitTestBehavior.opaque, | ||||
} | child: Container( | ||||
_bloc.refresh(); | alignment: Alignment.center, | ||||
}, | margin: EdgeInsets.only(right: 12.5), | ||||
child: Container( | padding: EdgeInsets.only(left: 16, right: 16, top: 2.5, bottom: 2.5), | ||||
margin: EdgeInsets.only( | decoration: BoxDecoration( | ||||
top: 10, left: 8, right: 8, bottom: 10), | border: Border.all( | ||||
decoration: BoxDecoration( | color: HexColor.fromHex(selectType == tabViewBtns[index].type ? _bloc.styleData.btnSelectedColor : _bloc.styleData.btnNoSelectedColor), | ||||
border: Border.all( | ), | ||||
color: HexColor.fromHex( | borderRadius: BorderRadius.circular(50)), | ||||
selectType == tabViewBtns[index].type | child: Text( | ||||
? _bloc.styleData.btnSelectedColor | tabViewBtns[index].name ?? "", | ||||
: _bloc.styleData.btnNoSelectedColor), | style: TextStyle( | ||||
), | fontSize: 11, 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)), | |||||
)), | |||||
), | |||||
)); | |||||
}), | }), | ||||
)) | )) | ||||
], | ], | ||||
@@ -191,11 +178,9 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
} | } | ||||
_selectDate(TabList tabList) async { | _selectDate(TabList tabList) async { | ||||
var result = await showDialog( | var result = await showDialog(context: context, builder: (context) => SelectDateYMDialog()); | ||||
context: context, builder: (context) => SelectDateYMDialog()); | |||||
if (result != null) { | if (result != null) { | ||||
var dataTime = DateFormat('yyyy-MM').format( | var dataTime = DateFormat('yyyy-MM').format(DateTime(int.parse(result['year']), int.parse(result['month']))); | ||||
DateTime(int.parse(result['year']), int.parse(result['month']))); | |||||
if (tabList.type == "input") { | if (tabList.type == "input") { | ||||
_bloc.inputShowDate = dataTime; | _bloc.inputShowDate = dataTime; | ||||
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); | _bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate); | ||||
@@ -210,9 +195,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
_buildBottomItem(TabList tabList) { | _buildBottomItem(TabList tabList) { | ||||
return ListView.builder( | return ListView.builder( | ||||
shrinkWrap: true, | shrinkWrap: true, | ||||
itemCount: tabList.type == 'input' | itemCount: tabList.type == 'input' ? _bloc.inputDataVM.length : _bloc.outputDataVM.length, | ||||
? _bloc.inputDataVM.length | |||||
: _bloc.outputDataVM.length, | |||||
itemBuilder: (context, index) { | itemBuilder: (context, index) { | ||||
return _buildItem(context, index, tabList); | return _buildItem(context, index, tabList); | ||||
}); | }); | ||||
@@ -224,11 +207,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
var modelItem = _bloc.inputDataVM[index]; | var modelItem = _bloc.inputDataVM[index]; | ||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | ||||
padding: | padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | ||||
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), | ||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex("#FFFFFF"), | |||||
borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Row( | Row( | ||||
@@ -238,21 +218,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Container( | Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), color: HexColor.fromHex("#FFFFF3F3"), border: Border.all(color: HexColor.fromHex(inputItemStyle.typeNameColor))), | ||||
color: HexColor.fromHex("#FFFFF3F3"), | |||||
border: Border.all( | |||||
color: HexColor.fromHex( | |||||
inputItemStyle.typeNameColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only( | padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), | ||||
left: 4, right: 4, top: 2, bottom: 2), | |||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
modelItem['type'] ?? "", | modelItem['type'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.typeNameColor), fontSize: 20.sp), | ||||
color: HexColor.fromHex( | |||||
inputItemStyle.typeNameColor), | |||||
fontSize: 20.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -272,14 +244,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
"+ ", | "+ ", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor)), | ||||
color: HexColor.fromHex(inputItemStyle.amountColor)), | |||||
), | ), | ||||
Text( | Text( | ||||
"¥ " + modelItem['amount'], | "¥ " + modelItem['amount'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor), fontSize: 30.sp, fontFamily: 'Din', package: 'zhiying_base_widget'), | ||||
color: HexColor.fromHex(inputItemStyle.amountColor), | |||||
fontSize: 30.sp), | |||||
) | ) | ||||
], | ], | ||||
) | ) | ||||
@@ -294,44 +263,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
inputItemStyle.orderIdText, | inputItemStyle.orderIdText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['order_id'], | modelItem['order_id'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 28.w, | width: 28.w, | ||||
), | ), | ||||
GestureDetector( | GestureDetector( | ||||
onTap: () { | onTap: () { | ||||
Clipboard.setData( | Clipboard.setData(ClipboardData(text: modelItem['order_id'])); | ||||
ClipboardData(text: modelItem['order_id'])); | |||||
Fluttertoast.showToast(msg: "已复制"); | Fluttertoast.showToast(msg: "已复制"); | ||||
}, | }, | ||||
child: Container( | child: Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), | ||||
color: HexColor.fromHex(inputItemStyle.copyBtnBgColor), | color: HexColor.fromHex(inputItemStyle.copyBtnBgColor), | ||||
border: Border.all( | border: Border.all(color: HexColor.fromHex(inputItemStyle.contentColor))), | ||||
color: | |||||
HexColor.fromHex(inputItemStyle.contentColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: EdgeInsets.only( | padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), | ||||
left: 16, right: 16, top: 1, bottom: 1), | |||||
child: Text( | child: Text( | ||||
inputItemStyle.copyBtnText, | inputItemStyle.copyBtnText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -348,18 +306,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
inputItemStyle.orderTypeText, | inputItemStyle.orderTypeText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['order_type'] ?? "", | modelItem['order_type'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | ||||
color: HexColor.fromHex("#FF999999"), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -368,9 +322,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
inputItemStyle.amountText + " ¥" + modelItem['amount'], | inputItemStyle.amountText + " ¥" + modelItem['amount'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)) | )) | ||||
@@ -386,18 +338,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
inputItemStyle.timeText, | inputItemStyle.timeText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['time'] ?? "", | modelItem['time'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | ||||
color: HexColor.fromHex("#FF999999"), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -405,13 +353,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
inputItemStyle.settleTimeText + | inputItemStyle.settleTimeText + " " + modelItem['settle_time'] ?? "", | ||||
" " + | style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp), | ||||
modelItem['settle_time'] ?? | |||||
"", | |||||
style: TextStyle( | |||||
color: HexColor.fromHex(inputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)) | )) | ||||
@@ -427,11 +370,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
///消费返回的Item | ///消费返回的Item | ||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | ||||
padding: | padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | ||||
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), | ||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex("#FFFFFF"), | |||||
borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Row( | Row( | ||||
@@ -443,19 +383,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), | ||||
color: HexColor.fromHex("#FFFFF3F3"), | color: HexColor.fromHex("#FFFFF3F3"), | ||||
border: Border.all( | border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.typeNameColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only( | padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), | ||||
left: 4, right: 4, top: 2, bottom: 2), | |||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
modelItem['type'] ?? "", | modelItem['type'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.typeNameColor), | |||||
fontSize: 20.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -475,16 +409,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
"- ", | "- ", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.amountColor)), | |||||
), | ), | ||||
Text( | Text( | ||||
"¥ " + modelItem['amount'], | "¥ " + modelItem['amount'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.amountColor), | |||||
fontSize: 30.sp), | |||||
) | ) | ||||
], | ], | ||||
) | ) | ||||
@@ -499,44 +428,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.orderIdText, | outputItemStyle.orderIdText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['order_id'], | modelItem['order_id'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 28.w, | width: 28.w, | ||||
), | ), | ||||
GestureDetector( | GestureDetector( | ||||
onTap: () { | onTap: () { | ||||
Clipboard.setData( | Clipboard.setData(ClipboardData(text: modelItem['order_id'])); | ||||
ClipboardData(text: modelItem['order_id'])); | |||||
Fluttertoast.showToast(msg: "已复制"); | Fluttertoast.showToast(msg: "已复制"); | ||||
}, | }, | ||||
child: Container( | child: Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), | ||||
color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), | color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), | ||||
border: Border.all( | border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.contentColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: EdgeInsets.only( | padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), | ||||
left: 16, right: 16, top: 1, bottom: 1), | |||||
child: Text( | child: Text( | ||||
outputItemStyle.copyBtnText ?? "", | outputItemStyle.copyBtnText ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -553,19 +471,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.consumeOrderTypeText, | outputItemStyle.consumeOrderTypeText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['order_type'] ?? "", | modelItem['order_type'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | ||||
color: HexColor.fromHex("#FF999999"), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -573,13 +486,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.consumeAmountText + | outputItemStyle.consumeAmountText + " ¥" + modelItem['amount'], | ||||
" ¥" + | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
modelItem['amount'], | |||||
style: TextStyle( | |||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)) | )) | ||||
@@ -595,19 +503,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.consumeTimeText, | outputItemStyle.consumeTimeText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['time'] ?? "", | modelItem['time'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | ||||
color: HexColor.fromHex("#FF999999"), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -633,11 +536,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
} else if (modelItem['type'] == '提现') { | } else if (modelItem['type'] == '提现') { | ||||
return Container( | return Container( | ||||
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | ||||
padding: | padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | ||||
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)), | ||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex("#FFFFFF"), | |||||
borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Row( | Row( | ||||
@@ -649,19 +549,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), | ||||
color: HexColor.fromHex("#FFFFF3F3"), | color: HexColor.fromHex("#FFFFF3F3"), | ||||
border: Border.all( | border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.typeNameColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: const EdgeInsets.only( | padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2), | ||||
left: 4, right: 4, top: 2, bottom: 2), | |||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
modelItem['type'] ?? "", | modelItem['type'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.typeNameColor), | |||||
fontSize: 20.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -681,16 +575,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
"- ", | "- ", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.amountColor)), | |||||
), | ), | ||||
Text( | Text( | ||||
"¥ " + modelItem['amount'], | "¥ " + modelItem['amount'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.amountColor), | |||||
fontSize: 30.sp), | |||||
) | ) | ||||
], | ], | ||||
) | ) | ||||
@@ -705,44 +594,33 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.orderIdText, | outputItemStyle.orderIdText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['order_id'], | modelItem['order_id'], | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 28.w, | width: 28.w, | ||||
), | ), | ||||
GestureDetector( | GestureDetector( | ||||
onTap: () { | onTap: () { | ||||
Clipboard.setData( | Clipboard.setData(ClipboardData(text: modelItem['order_id'])); | ||||
ClipboardData(text: modelItem['order_id'])); | |||||
Fluttertoast.showToast(msg: "已复制"); | Fluttertoast.showToast(msg: "已复制"); | ||||
}, | }, | ||||
child: Container( | child: Container( | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(4), | borderRadius: BorderRadius.circular(4), | ||||
color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), | color: HexColor.fromHex(outputItemStyle.copyBtnBgColor), | ||||
border: Border.all( | border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))), | ||||
color: HexColor.fromHex( | |||||
outputItemStyle.contentColor))), | |||||
child: Padding( | child: Padding( | ||||
padding: EdgeInsets.only( | padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), | ||||
left: 16, right: 16, top: 1, bottom: 1), | |||||
child: Text( | child: Text( | ||||
outputItemStyle.copyBtnText ?? "", | outputItemStyle.copyBtnText ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -759,20 +637,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.withdrawAccountText, | outputItemStyle.withdrawAccountText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['account'] ?? "", | modelItem['account'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -780,13 +652,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.withdrawAmountText + | outputItemStyle.withdrawAmountText + " ¥" + modelItem['amount'], | ||||
" ¥" + | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
modelItem['amount'], | |||||
style: TextStyle( | |||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)) | )) | ||||
@@ -802,19 +669,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.withdrawTimeText, | outputItemStyle.withdrawTimeText, | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
color: | |||||
HexColor.fromHex(outputItemStyle.contentColor), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
SizedBox( | SizedBox( | ||||
width: 4, | width: 4, | ||||
), | ), | ||||
Text( | Text( | ||||
modelItem['time'] ?? "", | modelItem['time'] ?? "", | ||||
style: TextStyle( | style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | ||||
color: HexColor.fromHex("#FF999999"), | |||||
fontSize: 22.sp), | |||||
), | ), | ||||
], | ], | ||||
)), | )), | ||||
@@ -822,14 +684,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
outputItemStyle.withdrawOrderStatusText + | outputItemStyle.withdrawOrderStatusText + " " + modelItem['order_status'] ?? "", | ||||
" " + | style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp), | ||||
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, | stream: _bloc.inputOutData, | ||||
builder: (context, asny) { | builder: (context, asny) { | ||||
// dataVM = asny.data; | // dataVM = asny.data; | ||||
return Container( | return Container( | ||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
@@ -869,9 +724,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
onRefresh: () { | onRefresh: () { | ||||
_bloc.inputRefresh(); | _bloc.inputRefresh(); | ||||
}, | }, | ||||
child: _bloc.inputDataVM == null | child: _bloc.inputDataVM == null ? Container() : _buildBottomItem(item)), | ||||
? Container() | |||||
: _buildBottomItem(item)), | |||||
) | ) | ||||
], | ], | ||||
), | ), | ||||
@@ -899,9 +752,7 @@ class _WalletBilDetailState extends State<WalletBilDetail> | |||||
onRefresh: () { | onRefresh: () { | ||||
_bloc.outputRefresh(); | _bloc.outputRefresh(); | ||||
}, | }, | ||||
child: _bloc.outputDataVM == null | child: _bloc.outputDataVM == null ? Container() : _buildBottomItem(item)), | ||||
? Container() | |||||
: _buildBottomItem(item)), | |||||
) | ) | ||||
], | ], | ||||
), | ), | ||||