|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/models/seller_template_color_list_model.dart';
|
|
|
|
import 'package:one_key/pages/my/marketing_center/theme_model.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:photo_view/photo_view_gallery.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../constant/state.dart';
|
|
|
|
import '../../../models/seller_template_color_list_model.dart';
|
|
|
|
import '../../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../../provider/user_model.dart';
|
|
|
|
import '../../../res/colors.dart';
|
|
|
|
import '../../../utils/dialog_util.dart';
|
|
|
|
import '../../../utils/event_bus.dart';
|
|
|
|
import '../../../utils/screen_util.dart';
|
|
|
|
import '../../../utils/utils.dart';
|
|
|
|
import '../../../widgets/MyDivider.dart';
|
|
|
|
import '../../../widgets/h_empty_view.dart';
|
|
|
|
import '../../../widgets/page_exception.dart';
|
|
|
|
import '../../../widgets/round_button.dart';
|
|
|
|
import '../../online_check/photo_view_wiget.dart';
|
|
|
|
// import 'package:card_swiper/card_swiper.dart';
|
|
|
|
|
|
|
|
import 'dart:convert' as convert;
|
|
|
|
|
|
|
|
import 'dart:math' as math;
|
|
|
|
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* 邀请函主题选择页面
|
|
|
|
* 邀请函主题选择页面预览
|
|
|
|
*/
|
|
|
|
|
|
|
|
class InvitationThemeHomePage extends StatefulWidget {
|
|
|
|
// final SellerTemplateColorListSunModel themeSunModel;
|
|
|
|
InvitationThemeHomePage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -35,52 +44,60 @@ class InvitationThemeHomePage extends StatefulWidget { |
|
|
|
}
|
|
|
|
|
|
|
|
class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
MarketingCenterProvider marketingCenterProvider;
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
//当前店铺选中的颜色和板式
|
|
|
|
|
|
|
|
String themeColor;
|
|
|
|
String themeType = '1'; //模版类型
|
|
|
|
// int indexSelectColor = 0; //选中第几个模版 (有配色选中index)
|
|
|
|
// int indexSelectNoColor = 0; //选中第几个模版 (无配色选中index)
|
|
|
|
// List<ThemeSunModel> marketingCenterProvider.templeteDatas = [];
|
|
|
|
String themeColor = '当前主题不可用';
|
|
|
|
String themeType; //模版类型
|
|
|
|
String url;
|
|
|
|
String themeTitle = '当前主题不可用'; //标题样式
|
|
|
|
|
|
|
|
ThemeModel themeModelCurrunt; //有配色对应的当前页面模版数据
|
|
|
|
|
|
|
|
PageController pageController;
|
|
|
|
double pageOffset = 0;
|
|
|
|
|
|
|
|
// ThemeModel themeModelCurrunt; //有配色对应的当前页面模版数据
|
|
|
|
SwiperController swiperController = SwiperController();
|
|
|
|
|
|
|
|
List movies = [
|
|
|
|
'https://q0.itc.cn/images01/20240605/50e704be01504cf2b2d8ba3999a0a681.jpeg',
|
|
|
|
'https://img1.baidu.com/it/u=364594147,3505938130&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1200',
|
|
|
|
'https://q0.itc.cn/images01/20240605/b94b61c5c766401698725d5b53c8f37d.jpeg',
|
|
|
|
'https://q0.itc.cn/images01/20240605/50e704be01504cf2b2d8ba3999a0a681.jpeg',
|
|
|
|
'https://img1.baidu.com/it/u=364594147,3505938130&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1200',
|
|
|
|
'https://q0.itc.cn/images01/20240605/b94b61c5c766401698725d5b53c8f37d.jpeg'
|
|
|
|
];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
pageController = PageController(viewportFraction: 1);
|
|
|
|
pageController.addListener(() {
|
|
|
|
setState(() => pageOffset = pageController.page);
|
|
|
|
});
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
_getThemeData();
|
|
|
|
bus.on("theme_color_type", (arg) {
|
|
|
|
themeColor = arg['themeColor'];
|
|
|
|
themeType = arg['themeType'];
|
|
|
|
SellerTemplateColorListSunModel themeSunModel =
|
|
|
|
marketingCenterProvider.templeteDatas[marketingCenterProvider
|
|
|
|
.templeteDatas
|
|
|
|
.indexWhere((element) => element.id == themeType)];
|
|
|
|
themeSunModel.themeColorDefault = themeColor;
|
|
|
|
bus.emit('theme_color_type_name', {
|
|
|
|
'templateName': themeSunModel.templateName,
|
|
|
|
'url': themeSunModel.colors.length == 0
|
|
|
|
? themeSunModel.url
|
|
|
|
: themeSunModel
|
|
|
|
.colors[themeSunModel.colors
|
|
|
|
.indexWhere((element) => element.colorName == themeColor)]
|
|
|
|
.url
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
bus.off('theme_color_type');
|
|
|
|
super.dispose();
|
|
|
|
// if (themeSunModel.themeColorDefault != null) {
|
|
|
|
// themeColor = themeSunModel.themeColorDefault;
|
|
|
|
// url = themeSunModel
|
|
|
|
// .colors[themeSunModel.colors
|
|
|
|
// .indexWhere((element) => element.colorName == themeColor)]
|
|
|
|
// .url;
|
|
|
|
// } else {
|
|
|
|
// if (themeSunModel.colors.length > 0) {
|
|
|
|
// themeColor = themeSunModel.colors[0].colorName;
|
|
|
|
// url = themeSunModel.colors[0].url;
|
|
|
|
// } else {
|
|
|
|
// url = themeSunModel.url;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// themeType = themeSunModel.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
_getThemeData() async {
|
|
...
|
...
|
@@ -95,6 +112,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
(element) =>
|
|
|
|
element.id == marketingCenterProvider.markDataModel.type);
|
|
|
|
themeType = marketingCenterProvider.templeteDatas[index].id;
|
|
|
|
swiperController.index = index;
|
|
|
|
|
|
|
|
List<ColorListModel> colors =
|
|
|
|
marketingCenterProvider.templeteDatas[index].colors;
|
|
...
|
...
|
@@ -143,8 +161,46 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// _selectTheme(String id) {
|
|
|
|
// List<ThemeSunModel> temp = [];
|
|
|
|
// temp.addAll(themeModelCurrunt.urls);
|
|
|
|
// temp.addAll(themeDatasno);
|
|
|
|
// List<String> tempUrls = temp.map((e) => e.url).toList();
|
|
|
|
|
|
|
|
// // List<String> temp =
|
|
|
|
// // themeModel.urls.map((e) => e.url).toList();
|
|
|
|
// // print(temp);
|
|
|
|
|
|
|
|
// // List<String> temp =
|
|
|
|
// // themeDatasno.map((e) => e.url).toList();
|
|
|
|
// print(temp);
|
|
|
|
// _showPhotoView(
|
|
|
|
// context, temp.indexWhere((element) => element.id == id), tempUrls,
|
|
|
|
// (index) {
|
|
|
|
// //选中的index
|
|
|
|
// themeType = temp[index].id; //当前选中模版的id
|
|
|
|
// setState(() {});
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
double _scale = 1.0;
|
|
|
|
double _previousScale = 1.0;
|
|
|
|
Offset _panOffset = Offset(0, 0);
|
|
|
|
Offset _previousPanOffset = Offset(0, 0);
|
|
|
|
|
|
|
|
void _onScaleUpdate(ScaleUpdateDetails details) {
|
|
|
|
setState(() {
|
|
|
|
_previousScale = _scale;
|
|
|
|
_scale *= details.scale;
|
|
|
|
_previousPanOffset = _panOffset;
|
|
|
|
_panOffset = _panOffset -
|
|
|
|
details.focalPoint -
|
|
|
|
_panOffset +
|
|
|
|
details.localFocalPoint;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_showPhotoView(BuildContext context, int index, List<String> imgs,
|
|
|
|
CustomCallBack callback,
|
|
|
|
{isShow = false, List dashName}) async {
|
|
|
|
// if (imgs.length == 1 &&
|
|
|
|
// imgs[0] ==
|
|
...
|
...
|
@@ -173,7 +229,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
needTap: false,
|
|
|
|
callback: (curruntIndex) {
|
|
|
|
//选中某个模版
|
|
|
|
callback(curruntIndex);
|
|
|
|
// callback(curruntIndex);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// Positioned(
|
|
...
|
...
|
@@ -205,75 +261,6 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
Utils.setBarStatus(true, color: Colors.white);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> imagesWidgets() {
|
|
|
|
List<Widget> images = [];
|
|
|
|
for (int i = 0; i < marketingCenterProvider.templeteDatas.length; i++) {
|
|
|
|
SellerTemplateColorListSunModel themeSunModel =
|
|
|
|
marketingCenterProvider.templeteDatas[i];
|
|
|
|
images.add(InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// _selectTheme(themeDatas[themeColor].urls[index].id);
|
|
|
|
//跳转到下一页
|
|
|
|
NavigatorUtil.goInvitationThemeHomePreviewPage(
|
|
|
|
context, themeSunModel);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
width: (ScreenUtil().screenWidth - w(32) - w(15)) / 2,
|
|
|
|
// height: w(390),
|
|
|
|
margin: EdgeInsets.only(right: i % 2 == 0 ? w(15) : 0),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(r(10)),
|
|
|
|
border: Border.all(
|
|
|
|
color: themeType == themeSunModel.id
|
|
|
|
? MyColours.color_005AA7
|
|
|
|
: MyColours.color_DBDBDB,
|
|
|
|
width: themeType == themeSunModel.id ? w(2) : w(1))),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
// VEmptyView(10),
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(r(8)),
|
|
|
|
topRight: Radius.circular(r(8))),
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
imageUrl: themeSunModel.colors == null ||
|
|
|
|
themeSunModel.colors.length == 0
|
|
|
|
? themeSunModel.url
|
|
|
|
: themeSunModel
|
|
|
|
.colors[themeColor == null
|
|
|
|
? 0
|
|
|
|
: themeSunModel.colors.indexWhere((element) =>
|
|
|
|
element.colorName ==
|
|
|
|
themeSunModel.themeColorDefault)]
|
|
|
|
.url,
|
|
|
|
width: (ScreenUtil().screenWidth - w(32) - w(15)) / 2,
|
|
|
|
height: w(348),
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(vertical: w(7), horizontal: w(3)),
|
|
|
|
width: double.infinity,
|
|
|
|
child: Text(
|
|
|
|
themeSunModel.templateName,
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000, fontSize: font(14)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
marketingCenterProvider.templeteDatas.forEach((themeSunModel) {});
|
|
|
|
return images;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
marketingCenterProvider =
|
|
...
|
...
|
@@ -286,7 +273,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageStateThemeHome,
|
|
|
|
callback: () async {},
|
|
|
|
emptyMsg: "暂时没有预订信息展示哦",
|
|
|
|
emptyMsg: "暂时没有信息展示哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
...
|
...
|
@@ -297,97 +284,318 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(24),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// DialogUtil.showThemeColorSelectDialogNew(
|
|
|
|
// context, themeSunModel.colors, callback: (object) {
|
|
|
|
// print(object);
|
|
|
|
// setState(() {
|
|
|
|
// themeColor = object;
|
|
|
|
// url = themeSunModel
|
|
|
|
// .colors[themeSunModel.colors.indexWhere(
|
|
|
|
// (element) => element.colorName == object)]
|
|
|
|
// .url;
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(16),
|
|
|
|
top: w(12),
|
|
|
|
bottom: w(12),
|
|
|
|
right: w(12)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'主题颜色选择',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
themeColor ?? '',
|
|
|
|
style: TextStyle(
|
|
|
|
color: themeColor == '当前主题不可用'
|
|
|
|
? MyColours.color_BFC4D4
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(11), vertical: w(4)),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/arrow_right_new.png",
|
|
|
|
width: w(9),
|
|
|
|
height: w(16),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
// RoundButton(
|
|
|
|
// text: '预览',
|
|
|
|
// gradientStart: MyColours.color_ffffff,
|
|
|
|
// gradientEnd: MyColours.color_ffffff,
|
|
|
|
// borderColor: MyColours.color_438E93,
|
|
|
|
// textColor: MyColours.color_438E93,
|
|
|
|
// radius: ScreenUtil().setWidth(22),
|
|
|
|
// fontSize: 24,
|
|
|
|
// width: w(72),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// isBold: true,
|
|
|
|
// onPressed: () {
|
|
|
|
// NavigatorUtil.goMarkingPreviewPage(context);
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
]))),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(16)),
|
|
|
|
child: Wrap(
|
|
|
|
runSpacing: w(15),
|
|
|
|
// spacing: w(15),
|
|
|
|
children: imagesWidgets(),
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(double.infinity, w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7)),
|
|
|
|
// VEmptyView(24),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(16),
|
|
|
|
top: w(12),
|
|
|
|
bottom: w(11),
|
|
|
|
right: w(12)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'介绍模块标题样式',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
themeTitle,
|
|
|
|
style: TextStyle(
|
|
|
|
color: themeTitle == '当前主题不可用'
|
|
|
|
? MyColours.color_BFC4D4
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: font(16)),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(11), vertical: w(4)),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/arrow_right_new.png",
|
|
|
|
width: w(9),
|
|
|
|
height: w(16),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
// RoundButton(
|
|
|
|
// text: '预览',
|
|
|
|
// gradientStart: MyColours.color_ffffff,
|
|
|
|
// gradientEnd: MyColours.color_ffffff,
|
|
|
|
// borderColor: MyColours.color_438E93,
|
|
|
|
// textColor: MyColours.color_438E93,
|
|
|
|
// radius: ScreenUtil().setWidth(22),
|
|
|
|
// fontSize: 24,
|
|
|
|
// width: w(72),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// isBold: true,
|
|
|
|
// onPressed: () {
|
|
|
|
// NavigatorUtil.goMarkingPreviewPage(context);
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
]))),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(double.infinity, w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7)),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(16), top: w(12), bottom: w(11), right: w(16)),
|
|
|
|
child: Text(
|
|
|
|
'通知主题选择(左右滑动选择要使用的主题)',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151, fontSize: font(16)),
|
|
|
|
)),
|
|
|
|
VEmptyView(24),
|
|
|
|
// GridView.builder(
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: w(16)),
|
|
|
|
// controller: controller,
|
|
|
|
// // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
// shrinkWrap: true,
|
|
|
|
// itemCount: marketingCenterProvider.templeteDatas.length,
|
|
|
|
// //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
// //横轴元素个数
|
|
|
|
// crossAxisCount: 2,
|
|
|
|
// //纵轴间距
|
|
|
|
// mainAxisSpacing: w(15),
|
|
|
|
// //横轴间距
|
|
|
|
// crossAxisSpacing: w(15),
|
|
|
|
// //子组件宽高长度比例
|
|
|
|
// // childAspectRatio:
|
|
|
|
// // (ScreenUtil().screenWidth - w(62)) / 2 / 370
|
|
|
|
// ),
|
|
|
|
// itemBuilder: (BuildContext context, int index) {
|
|
|
|
// SellerTemplateColorListSunModel themeSunModel =
|
|
|
|
// marketingCenterProvider.templeteDatas[index];
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// // _selectTheme(themeDatas[themeColor].urls[index].id);
|
|
|
|
// //跳转到下一页
|
|
|
|
// NavigatorUtil.goInvitationThemeHomePreviewPage(
|
|
|
|
// context, themeSunModel);
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// height: w(385),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(r(10)),
|
|
|
|
// border: Border.all(
|
|
|
|
// color: themeType == themeSunModel.id
|
|
|
|
// ? MyColours.color_005AA7
|
|
|
|
// : MyColours.color_DBDBDB,
|
|
|
|
// width: themeType == themeSunModel.id
|
|
|
|
// ? w(2)
|
|
|
|
// : w(1))),
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// VEmptyView(10),
|
|
|
|
// CachedNetworkImage(
|
|
|
|
// imageUrl: themeSunModel.colors == null ||
|
|
|
|
// themeSunModel.colors.length == 0
|
|
|
|
// ? themeSunModel.url
|
|
|
|
// : themeSunModel
|
|
|
|
// .colors[themeColor == null
|
|
|
|
// ? 0
|
|
|
|
// : themeSunModel.colors
|
|
|
|
// .indexWhere((element) =>
|
|
|
|
// element.colorName ==
|
|
|
|
// themeSunModel
|
|
|
|
// .themeColorDefault)]
|
|
|
|
// .url,
|
|
|
|
// width:
|
|
|
|
// (ScreenUtil().screenWidth - w(62)) / 2,
|
|
|
|
// height: w(348),
|
|
|
|
// fit: BoxFit.fitWidth,
|
|
|
|
// alignment: Alignment.topCenter,
|
|
|
|
// ),
|
|
|
|
// VEmptyView(20),
|
|
|
|
// Container(
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// vertical: w(6), horizontal: w(2)),
|
|
|
|
// width: double.infinity,
|
|
|
|
// child: Text(
|
|
|
|
// themeSunModel.templateName,
|
|
|
|
// maxLines: 1,
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
// textAlign: TextAlign.left,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_000000,
|
|
|
|
// fontSize: font(14)),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ));
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(double.infinity, w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7)),
|
|
|
|
VEmptyView(60),
|
|
|
|
// Container(
|
|
|
|
// height: w(300),
|
|
|
|
// child: PhotoViewGallery.builder(
|
|
|
|
// scrollPhysics: const BouncingScrollPhysics(),
|
|
|
|
// builder: (BuildContext context, int index) {
|
|
|
|
// return PhotoViewGalleryPageOptions(
|
|
|
|
// imageProvider: NetworkImage(movies[index]),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
// itemCount: movies.length,
|
|
|
|
// backgroundDecoration: BoxDecoration(color: Colors.white),
|
|
|
|
// pageController: PageController(initialPage: 0),
|
|
|
|
// onPageChanged: (index) => setState(() {
|
|
|
|
// // currentIndex = index;
|
|
|
|
// // if (widget.pageChanged != null) {
|
|
|
|
// // widget.pageChanged(index);
|
|
|
|
// // }
|
|
|
|
// }))),
|
|
|
|
Container(
|
|
|
|
height: w(359),
|
|
|
|
child: new Swiper(
|
|
|
|
controller:swiperController,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
SellerTemplateColorListSunModel themeSunModel = marketingCenterProvider.templeteDatas[index];
|
|
|
|
return new ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(r(10)),
|
|
|
|
child: CachedNetworkImage(
|
|
|
|
imageUrl: themeSunModel.colors == null ||
|
|
|
|
themeSunModel.colors.length == 0
|
|
|
|
? themeSunModel.url
|
|
|
|
: themeSunModel
|
|
|
|
.colors[themeColor == null
|
|
|
|
? 0
|
|
|
|
: themeSunModel.colors
|
|
|
|
.indexWhere((element) =>
|
|
|
|
element.colorName ==
|
|
|
|
themeSunModel
|
|
|
|
.themeColorDefault)]
|
|
|
|
.url,
|
|
|
|
// width:
|
|
|
|
// (ScreenUtil().screenWidth - w(62)) / 2,
|
|
|
|
// height: w(348),
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
alignment: Alignment.topCenter,
|
|
|
|
));
|
|
|
|
},
|
|
|
|
// onTap: (v) {
|
|
|
|
// // print(v);
|
|
|
|
// },
|
|
|
|
onIndexChanged: (index) {
|
|
|
|
print(index);
|
|
|
|
// 当前选中的主题
|
|
|
|
},
|
|
|
|
itemCount: marketingCenterProvider.templeteDatas.length,
|
|
|
|
viewportFraction: 0.5,
|
|
|
|
scale: 0.5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Container(
|
|
|
|
// // height: w(300),
|
|
|
|
// height: w(359),
|
|
|
|
// child: PageView(
|
|
|
|
// controller: pageController,
|
|
|
|
// children: List.generate(movies.length, (index) {
|
|
|
|
// return SlidingCard(
|
|
|
|
// offset: pageOffset - index,
|
|
|
|
// movie: movies[index],
|
|
|
|
// index: index);
|
|
|
|
// }),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
|
|
|
|
// Swiper(
|
|
|
|
|
|
|
|
// itemBuilder: (BuildContext context,int index){
|
|
|
|
// return Image.network("http://nosqn.colorcun.com/app/seller-hj-empty.png",fit: BoxFit.fill,);
|
|
|
|
// },
|
|
|
|
// itemCount: 3,
|
|
|
|
// pagination: SwiperPagination(),
|
|
|
|
// control: SwiperControl(),
|
|
|
|
// ),
|
|
|
|
// GestureDetector(
|
|
|
|
// onScaleUpdate: _onScaleUpdate,
|
|
|
|
// child: Transform(
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// transform: Matrix4.identity()
|
|
|
|
// ..translate(_panOffset.dx, _panOffset.dy)
|
|
|
|
// ..scale(_scale),
|
|
|
|
// child: Image.network(
|
|
|
|
// 'http://nosqn.colorcun.com/app/seller-hj-empty.png',
|
|
|
|
// fit: BoxFit.contain,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// _showPhotoView(context, 0, [url]);
|
|
|
|
// },
|
|
|
|
// child: CachedNetworkImage(
|
|
|
|
// imageUrl: url,
|
|
|
|
// width: ScreenUtil().screenWidth - w(32),
|
|
|
|
// fit: BoxFit.fitWidth,
|
|
|
|
// alignment: Alignment.topCenter,
|
|
|
|
// )),
|
|
|
|
],
|
|
|
|
)))
|
|
|
|
))),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
text: '返回',
|
|
|
|
width: w(100),
|
|
|
|
height: w(43),
|
|
|
|
radius: r(5),
|
|
|
|
fontSize: 32,
|
|
|
|
isBold: true,
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
HEmptyView(24),
|
|
|
|
Expanded(
|
|
|
|
child: RoundButton(
|
|
|
|
text: '保存并返回',
|
|
|
|
height: w(43),
|
|
|
|
radius: r(5),
|
|
|
|
isBold: true,
|
|
|
|
fontSize: 32,
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
onPressed: () async {
|
|
|
|
//接口成功后刷新并返回前一页
|
|
|
|
//接口
|
|
|
|
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// 'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
// .user
|
|
|
|
// .sellerid,
|
|
|
|
// 'type': themeType,
|
|
|
|
// 'lite_class': themeColor == null
|
|
|
|
// ? null
|
|
|
|
// : themeSunModel
|
|
|
|
// .colors[themeSunModel.colors.indexWhere(
|
|
|
|
// (element) =>
|
|
|
|
// element.colorName == themeColor)]
|
|
|
|
// .liteClass
|
|
|
|
// };
|
|
|
|
|
|
|
|
// bool success = await marketingCenterProvider
|
|
|
|
// .setSellerTemplateConf(context, params,
|
|
|
|
// showLoading: true);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('设置成功');
|
|
|
|
// //选择当前模版+主题色
|
|
|
|
// bus.emit('theme_color_type', {
|
|
|
|
// 'themeColor': themeColor,
|
|
|
|
// 'themeType': themeType,
|
|
|
|
// });
|
|
|
|
// Navigator.pop(context);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
...
|
...
|
@@ -395,3 +603,104 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SlidingCard extends StatelessWidget {
|
|
|
|
final double offset;
|
|
|
|
final String movie;
|
|
|
|
final int index;
|
|
|
|
const SlidingCard({this.offset, this.movie, this.index});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
int select = 0;
|
|
|
|
double gauss = math.exp(-(math.pow((offset.abs() - 0.5), 2) / 0.08));
|
|
|
|
if (Offset(-32 * gauss * offset.sign, 0).dx == -0.0) {
|
|
|
|
//最中间的图
|
|
|
|
select = index;
|
|
|
|
}
|
|
|
|
return Transform.translate(
|
|
|
|
offset: Offset(-32 * gauss * offset.sign, 0),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
print(gauss);
|
|
|
|
print(Offset(-32 * gauss * offset.sign, 0));
|
|
|
|
print(index);
|
|
|
|
},
|
|
|
|
child: Card(
|
|
|
|
margin: EdgeInsets.only(left: 8, right: 8, bottom: 8),
|
|
|
|
elevation: 8,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(32),
|
|
|
|
),
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
r(10),
|
|
|
|
),
|
|
|
|
child: Image.network(
|
|
|
|
'${movie}',
|
|
|
|
width: select == index ? w(375) : w(179),
|
|
|
|
height: select == index ? w(359) : w(90),
|
|
|
|
// height: MediaQuery.of(context).size.height * 0.3,
|
|
|
|
alignment: Alignment(-offset.abs(), 0),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// SizedBox(
|
|
|
|
// height: 8,
|
|
|
|
// ),
|
|
|
|
// Expanded(
|
|
|
|
// child: Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: Column(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Text(
|
|
|
|
// '${movie.name}',
|
|
|
|
// style:
|
|
|
|
// TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
|
// ),
|
|
|
|
// SizedBox(
|
|
|
|
// height: 10,
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// '上架时间: ${movie.date}',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 14, fontWeight: FontWeight.normal),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// '${movie.intor}',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 14,
|
|
|
|
// fontWeight: FontWeight.normal,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// Row(
|
|
|
|
// children: <Widget>[
|
|
|
|
// SizedBox(width: 16,),
|
|
|
|
// Text(
|
|
|
|
// '${movie.price}',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: 18, fontWeight: FontWeight.bold),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// MaterialButton(
|
|
|
|
// onPressed: () {},
|
|
|
|
// color: Colors.black,
|
|
|
|
// child: Text('购买'),
|
|
|
|
// textColor: Colors.white,
|
|
|
|
// shape: RoundedRectangleBorder(
|
|
|
|
// borderRadius: BorderRadius.circular(32),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// SizedBox(width: 16,),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|