Commit 339624d9d0353c571691401af92b5654c0978648

Authored by wdn127929
1 parent 93ffde6b

选择主题数据准备

... ... @@ -36,11 +36,13 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
//当前店铺选中的颜色和板式
String themeColor = '摩洛哥蓝';
String themeType = '4';
int indexSelect = 0; //选中第几个模版
String themeType = '4'; //模版类型
// int indexSelectColor = 0; //选中第几个模版 (有配色选中index)
// int indexSelectNoColor = 0; //选中第几个模版 (无配色选中index)
List<ThemeSunModel> themeDatasno = [];
ThemeModel themeModelCurrunt; //有配色对应的当前页面模版数据
@override
void initState() {
super.initState();
... ... @@ -950,7 +952,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
themeDatas['群青过渡'] = themeModel1;
}
_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(() {});
});
}
_showPhotoView(BuildContext context, int index, List<String> imgs,
CustomCallBack callback,
{isShow = false, List dashName}) async {
// if (imgs.length == 1 &&
// imgs[0] ==
... ... @@ -971,30 +996,42 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
alignment: Alignment.bottomCenter,
children: <Widget>[
PhotoPreview(
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName),
Positioned(
bottom: w(20),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: w(30), vertical: w(10)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(r(30)),
),
child: Text(
'应用主题',
style: TextStyle(
decoration: TextDecoration.none,
color: MyColours.color_515151,
fontSize: font(16)),
),
))
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName,
needMask: false,
needTap: false,
callback: (curruntIndex) {
//选中某个模版
callback(curruntIndex);
},
),
// Positioned(
// bottom: w(20),
// child: InkWell(
// onTap: () {
// callback(index);
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: w(30), vertical: w(10)),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.circular(r(30)),
// ),
// child: Text(
// '应用',
// style: TextStyle(
// decoration: TextDecoration.none,
// color: MyColours.color_515151,
// fontSize: font(16)),
// ),
// ),
// ))
],
);
return child;
return Material(child: child);
});
Utils.setBarStatus(true, color: Colors.white);
}
... ... @@ -1091,28 +1128,28 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
childAspectRatio:
(ScreenUtil().screenWidth - w(62)) / 2 / 370),
itemBuilder: (BuildContext context, int index) {
ThemeModel themeModel = themeDatas[themeColor];
themeModelCurrunt = themeDatas[themeColor];
return InkWell(
onTap: () {
List<String> temp =
themeModel.urls.map((e) => e.url).toList();
print(temp);
_showPhotoView(context, indexSelect,
themeModel.urls.map((e) => e.url).toList());
_selectTheme(themeDatas[themeColor].urls[index].id);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
border: Border.all(
color: indexSelect == index
color: themeType ==
themeModelCurrunt.urls[index].id
? MyColours.color_005AA7
: MyColours.color_DBDBDB,
width: indexSelect == index ? w(2) : w(1))),
width: themeType ==
themeModelCurrunt.urls[index].id
? w(2)
: w(1))),
child: Column(
children: [
VEmptyView(10),
CachedNetworkImage(
imageUrl: themeModel.urls[index].url,
imageUrl: themeModelCurrunt.urls[index].url,
width: (ScreenUtil().screenWidth - w(62)) / 2,
height: w(348),
fit: BoxFit.fitWidth,
... ... @@ -1124,7 +1161,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
vertical: w(6), horizontal: w(2)),
width: double.infinity,
child: Text(
themeModel.urls[index].name,
themeModelCurrunt.urls[index].name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
... ... @@ -1147,7 +1184,7 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
callback: (object) {
print(object);
setState(() {
indexSelect = object;
themeColor = object;
});
});
},
... ... @@ -1220,21 +1257,30 @@ class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
itemBuilder: (BuildContext context, int index) {
ThemeSunModel themeModel = themeDatasno[index];
return InkWell(
// onTap: () {
// List<String> temp =
// themeDatasno.map((e) => e.url).toList();
// print(temp);
// _showPhotoView(context, index,
// themeDatasno.map((e) => e.url).toList(), (index) {
// //
// themeType = themeDatasno[index].id;
// setState(() {});
// });
// },
onTap: () {
List<String> temp =
themeDatasno.map((e) => e.url).toList();
print(temp);
_showPhotoView(context, indexSelect,
themeDatasno.map((e) => e.url).toList());
_selectTheme(themeModel.id);
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
border: Border.all(
color: indexSelect == index
color: themeType == themeDatasno[index].id
? MyColours.color_005AA7
: MyColours.color_DBDBDB,
width: indexSelect == index ? w(2) : w(1))),
width: themeType == themeDatasno[index].id
? w(2)
: w(1))),
child: Column(
children: [
VEmptyView(10),
... ...
... ... @@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/pick_date_nonli_gongli/pick_calendar_month.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
... ... @@ -16,13 +17,17 @@ class PhotoPreview extends StatefulWidget {
final bool isShow;
final List dashName;
final bool needMask;
final bool needTap;
final CustomCallBack callback;
PhotoPreview(
{this.initialIndex,
this.photoList,
this.isShow,
this.dashName,
this.needMask = true})
this.needMask = true,
this.needTap = true,
this.callback})
: pageController = PageController(initialPage: initialIndex);
@override
... ... @@ -71,6 +76,11 @@ class _PhotoPreviewState extends State<PhotoPreview> {
child: InkWell(
onTap: () {
Navigator.of(context).pop();
if (!widget.needTap) {
if (widget.callback != null) {
widget.callback(currentIndex);
}
}
},
child: Container(
decoration: BoxDecoration(
... ...