@@ -1,11 +1,11 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_bloc.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_repository.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_sk.dart';
import 'package:zhiying_base_widget/widgets/goods_details/footer/model/goods_details_footer_model.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:cached_network_image/cached_network_image.dart';
///
/// 商品详情底部Widget
@@ -21,7 +21,9 @@ class GoodsDetailsFooterWidget extends StatelessWidget {
visible: !EmptyUtil.isEmpty(model),
replacement: GoodsDetailsFooterSkeleton(),
child: BlocProvider<GoodsDetailsFooterBloc>(
create: (_) => GoodsDetailsFooterBloc(repository: GoodsDetailsFooterRepository())..add(GoodsDetailsFooterInitEvent(model: model)),
create: (_) =>
GoodsDetailsFooterBloc(repository: GoodsDetailsFooterRepository())
..add(GoodsDetailsFooterInitEvent(model: model)),
child: GooddsDetailsFooterContainer(),
),
);
@@ -30,10 +32,12 @@ class GoodsDetailsFooterWidget extends StatelessWidget {
class GooddsDetailsFooterContainer extends StatefulWidget {
@override
_GooddsDetailsFooterContainerState createState() => _GooddsDetailsFooterContainerState();
_GooddsDetailsFooterContainerState createState() =>
_GooddsDetailsFooterContainerState();
}
class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContainer> {
class _GooddsDetailsFooterContainerState
extends State<GooddsDetailsFooterContainer> {
/// 打开首页
void _openHome() {}
@@ -67,18 +71,21 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
}
Widget _getMainWidget(GoodsDetailsFooterModel model) {
return Container(
height: 70,
width: double.infinity,
padding: const EdgeInsets.only(bottom: 10, top: 12.5, left: 21, right: 12.5),
decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0), blurRadius: 5.0, spreadRadius: 2.0),
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0)),
// ],
color: Colors.white,
double height = MediaQuery.of(context).padding.bottom;
return SafeArea(
child: Container(
width: double.infinity,
padding: EdgeInsets.only(
bottom: (height > 10 ? 0 : 10), top: 10, left: 21, right: 12.5),
decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0), blurRadius: 5.0, spreadRadius: 2.0),
// BoxShadow(color: Colors.grey[300], offset: Offset(0.0, 0.0)),
// ],
color: Colors.white,
),
child: Container(height: 44, child: _getMainWidet(model)),
),
child: _getMainWidet(model),
);
}
@@ -108,12 +115,18 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
onTap: () => _openHome(),
child: Padding(
padding: const EdgeInsets.only(right: 35),
child: _getCustomWidget(model?.home ?? '首页', model?.home_color ?? '999999', model?.home_icon ?? ''),
child: _getCustomWidget(model?.home ?? '首页',
model?.home_color ?? '999999', model?.home_icon ?? ''),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _collectOnClick(),
child: Padding(padding: const EdgeInsets.only(right: 0), child: _getCustomWidget(model?.collect ?? '收藏', model?.collect_color ?? '999999', model?.collect_icon ?? '')))
child: Padding(
padding: const EdgeInsets.only(right: 0),
child: _getCustomWidget(
model?.collect ?? '收藏',
model?.collect_color ?? '999999',
model?.collect_icon ?? '')))
],
);
}
@@ -123,7 +136,10 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
return Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[_getFxzButton(model), _getZgsButton(model)],
children: <Widget>[
_getFxzButton(model),
_getZgsButton(model),
],
);
}
@@ -133,18 +149,44 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
onTap: () => _shareOnClick(),
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
height: 44,
width: 110,
// padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
decoration: BoxDecoration(
gradient: LinearGradient(colors: [HexColor.fromHex(model?.share_earn_bg1_color ?? '#FFCA66'), HexColor.fromHex(model?.share_earn_bg2_color ?? '#FFD961')], begin: Alignment.centerLeft, end: Alignment.centerRight),
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25), topLeft: Radius.circular(25))),
gradient: LinearGradient(colors: [
HexColor.fromHex(model?.share_earn_bg1_color ?? '#FFCA66'),
HexColor.fromHex(model?.share_earn_bg2_color ?? '#FFD961')
], begin: Alignment.centerLeft, end: Alignment.centerRight),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25), topLeft: Radius.circular(25))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RichText(
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.share_earn_val_color ?? 'FFFFFF')), children: [
TextSpan(text: model?.share_value ?? '0.0', style: TextStyle(fontSize: 15, color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), fontFamily: 'Din', package: 'zhiying_base_widget')),
]),
text: TextSpan(
text: '¥ ',
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex(
model?.share_earn_val_color ?? 'FFFFFF')),
children: [
TextSpan(
text: model?.share_value ?? '0.0',
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex(
model?.share_earn_color ?? '#FFFFFF'),
fontFamily: 'Din',
package: 'zhiying_base_widget')),
]),
),
Text(
model?.share_earn ?? '分享赚',
style: TextStyle(
color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'),
fontSize: 12),
),
Text(model?.share_earn ?? '分享赚', style: TextStyle(color: HexColor.fromHex(model?.share_earn_color ?? '#FFFFFF'), fontSize: 15))
],
),
),
@@ -158,25 +200,45 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
onTap: () => _savemoneyOnClick(),
child: Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
// padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5),
height: 44,
width: 110,
decoration: BoxDecoration(
gradient: LinearGradient(colors: [HexColor.fromHex(model?.save_earn_bg1_color ?? '#FF6969'), HexColor.fromHex(model?.save_earn_bg2_color ?? '#FF4646')], begin: Alignment.centerLeft, end: Alignment.centerRight),
borderRadius: BorderRadius.only(bottomRight: Radius.circular(25), topRight: Radius.circular(25))),
gradient: LinearGradient(colors: [
HexColor.fromHex(model?.save_earn_bg1_color ?? '#FF6969'),
HexColor.fromHex(model?.save_earn_bg2_color ?? '#FF4646')
], begin: Alignment.centerLeft, end: Alignment.centerRight),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(25),
topRight: Radius.circular(25))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RichText(
text: TextSpan(text: '¥ ', style: TextStyle(fontSize: 12, color: HexColor.fromHex(model?.save_earn_val_color ?? 'FFFFFF')), children: [
TextSpan(
text: model?.slef_buy_value ??'0.0',
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex(model?.save_earn_val_color ?? '#FFFFFF'),
fontFamily: 'Din',
package: 'zhiying_base_widget',
)),
]),
text: TextSpan(
text: '¥ ',
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex(
model?.save_earn_val_color ?? 'FFFFFF')),
children: [
TextSpan(
text: model?.slef_buy_value ?? '0.0',
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex(
model?.save_earn_val_color ?? '#FFFFFF'),
fontFamily: 'Din',
package: 'zhiying_base_widget',
)),
]),
),
Text(model?.save_earn ?? '自购省', style: TextStyle(color: HexColor.fromHex(model?.save_earn_color ?? '#FFFFFF'), fontSize: 15))
Text(model?.save_earn ?? '自购省',
style: TextStyle(
color:
HexColor.fromHex(model?.save_earn_color ?? '#FFFFFF'),
fontSize: 12))
],
),
),
@@ -197,8 +259,10 @@ class _GooddsDetailsFooterContainerState extends State<GooddsDetailsFooterContai
),
// Container( width: 25, margin: const EdgeInsets.only(bottom: 3), child: CachedNetworkImage(imageUrl: icon, fit: BoxFit.fill, width: 25,),),
const SizedBox(height: 3),
/// 图片
Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: 11))
Text(text,
style: TextStyle(color: HexColor.fromHex(textColor), fontSize: 11))
],
);
}