@@ -0,0 +1,230 @@ | |||||
import 'package:flutter/cupertino.dart'; | |||||
import 'package:flutter/material.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_preview.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class GoodsShareEditor extends StatefulWidget { | |||||
@override | |||||
_GoodsShareEditorState createState() => _GoodsShareEditorState(); | |||||
} | |||||
class _GoodsShareEditorState extends State<GoodsShareEditor> { | |||||
TextEditingController _controller; | |||||
@override | |||||
void initState() { | |||||
_controller = TextEditingController( | |||||
text: | |||||
'{标题}\n原价】{原价}元\n【券后价】{券后价}元\n【用嗨如意再省】{补贴省}元\n -------------\n 復製{淘口令},\n 用【Tao·寳】下单\n -------------\n 【商品链接】\n {商品链接}'); | |||||
super.initState(); | |||||
} | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return Scaffold( | |||||
appBar: _createNav(), | |||||
body: GestureDetector( | |||||
onTap: () { | |||||
FocusScope.of(context).requestFocus(FocusNode()); | |||||
}, | |||||
child: SingleChildScrollView( | |||||
child: Column( | |||||
children: <Widget>[ | |||||
_createCommission(), | |||||
_createInput(), | |||||
_createDesc(), | |||||
_createBottom(), | |||||
], | |||||
), | |||||
), | |||||
), | |||||
); | |||||
} | |||||
// 导航栏 | |||||
Widget _createNav() { | |||||
return CupertinoNavigationBar( | |||||
border: Border( | |||||
bottom: BorderSide( | |||||
width: 0.0, // One physical pixel. | |||||
style: BorderStyle.none, | |||||
), | |||||
), | |||||
// backgroundColor: HexColor.fromHex('#ffffff'), | |||||
leading: Navigator.canPop(context) | |||||
? GestureDetector( | |||||
child: Container( | |||||
padding: EdgeInsets.zero, | |||||
child: Icon( | |||||
Icons.arrow_back_ios, | |||||
size: 20, | |||||
), | |||||
), | |||||
onTap: () { | |||||
if (Navigator.canPop(context)) { | |||||
Navigator.pop(context); | |||||
} | |||||
}, | |||||
) | |||||
: Container(), | |||||
middle: Text( | |||||
'编辑模版', | |||||
style: TextStyle( | |||||
fontSize: 15, | |||||
color: HexColor.fromHex('#333333'), | |||||
), | |||||
), | |||||
); | |||||
} | |||||
Widget _createCommission() { | |||||
return Container( | |||||
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), | |||||
padding: EdgeInsets.only(left: 10, right: 10), | |||||
width: double.infinity, | |||||
height: 32, | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | |||||
child: Row( | |||||
crossAxisAlignment: CrossAxisAlignment.center, | |||||
children: <Widget>[ | |||||
Container( | |||||
width: 20, | |||||
height: 20, | |||||
margin: EdgeInsets.only(right: 10), | |||||
decoration: BoxDecoration( | |||||
color: Colors.redAccent, | |||||
borderRadius: BorderRadius.circular(10)), | |||||
), | |||||
Text( | |||||
'请不要修改 {} 之间的文字避免无法使用', | |||||
style: TextStyle( | |||||
fontSize: 13, | |||||
fontWeight: FontWeight.bold, | |||||
color: Color(0xff333333)), | |||||
), | |||||
], | |||||
), | |||||
); | |||||
} | |||||
Widget _createBottom() { | |||||
return SafeArea( | |||||
child: Container( | |||||
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), | |||||
child: Row( | |||||
children: <Widget>[ | |||||
Expanded( | |||||
child: Container( | |||||
height: 36, | |||||
decoration: BoxDecoration( | |||||
color: Colors.red, | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
child: Center( | |||||
child: Text( | |||||
'恢复默认', | |||||
style: TextStyle(color: Colors.white), | |||||
), | |||||
), | |||||
), | |||||
), | |||||
Expanded( | |||||
child: Container( | |||||
margin: EdgeInsets.only(left: 5), | |||||
height: 36, | |||||
decoration: BoxDecoration( | |||||
color: Colors.orangeAccent, | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
child: Center( | |||||
child: Text( | |||||
'保存模板', | |||||
style: TextStyle(color: Colors.white), | |||||
), | |||||
), | |||||
), | |||||
), | |||||
Expanded( | |||||
child: GestureDetector( | |||||
child: Container( | |||||
margin: EdgeInsets.only(left: 5), | |||||
height: 36, | |||||
decoration: BoxDecoration( | |||||
color: Colors.amber, | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
child: Center( | |||||
child: Text( | |||||
'预览模板', | |||||
style: TextStyle(color: Colors.white), | |||||
), | |||||
), | |||||
), | |||||
onTap: () { | |||||
_showPreview(); | |||||
}, | |||||
), | |||||
), | |||||
], | |||||
), | |||||
), | |||||
); | |||||
} | |||||
Widget _createInput() { | |||||
return Container( | |||||
width: double.infinity, | |||||
margin: EdgeInsets.all(12), | |||||
padding: EdgeInsets.all(10), | |||||
height: 180, | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | |||||
child: CupertinoTextField( | |||||
controller: _controller, | |||||
decoration: BoxDecoration(), | |||||
keyboardType: TextInputType.multiline, | |||||
style: TextStyle( | |||||
fontSize: 12, | |||||
fontWeight: FontWeight.bold, | |||||
color: Color(0xff333333), | |||||
), | |||||
maxLines: null, | |||||
), | |||||
); | |||||
} | |||||
Widget _createDesc() { | |||||
return Container( | |||||
width: double.infinity, | |||||
margin: EdgeInsets.all(12), | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, borderRadius: BorderRadius.circular(8)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Container( | |||||
margin: EdgeInsets.only(top: 10), | |||||
width: 70, | |||||
height: 30, | |||||
color: Colors.redAccent, | |||||
), | |||||
Padding( | |||||
padding: EdgeInsets.all(10), | |||||
child: Text( | |||||
'1.{标题} 表示商品标题\n2.{商品原价} 表示在售价格\n3.{券后价} 表示券后价格\n4.{补贴省} 表示平台补贴\n5.{推荐理由} 表示商品的推荐词,可为空\n6.{淘口令} 表示商品下单的口令\n7.{商品链接} 表示商品的链接', | |||||
style: TextStyle(fontSize: 12, color: Color(0xff999999)), | |||||
), | |||||
) | |||||
], | |||||
), | |||||
); | |||||
} | |||||
void _showPreview() { | |||||
showCupertinoModalPopup( | |||||
context: context, | |||||
builder: (context) => GoodsSharePreview(), | |||||
); | |||||
} | |||||
} |
@@ -0,0 +1,102 @@ | |||||
import 'dart:ui'; | |||||
import 'package:flutter/material.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_edit.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_item.dart'; | |||||
class GoodsSharePreview extends StatefulWidget { | |||||
@override | |||||
_GoodsSharePreviewState createState() => _GoodsSharePreviewState(); | |||||
} | |||||
class _GoodsSharePreviewState extends State<GoodsSharePreview> { | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return GestureDetector( | |||||
onTap: () { | |||||
Navigator.pop(context); | |||||
}, | |||||
child: Scaffold( | |||||
backgroundColor: Colors.transparent, | |||||
body: BackdropFilter( | |||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), | |||||
child: Column( | |||||
children: <Widget>[ | |||||
Expanded( | |||||
child: Container(), | |||||
), | |||||
Container( | |||||
width: double.infinity, | |||||
padding: EdgeInsets.only(left: 12.5, right: 12.5, top: 15), | |||||
decoration: BoxDecoration( | |||||
color: Colors.white, | |||||
borderRadius: BorderRadius.circular(13), | |||||
), | |||||
child: SafeArea( | |||||
top: false, | |||||
child: Column( | |||||
children: <Widget>[ | |||||
Padding( | |||||
padding: const EdgeInsets.only(bottom: 8.0), | |||||
child: Text( | |||||
'预览模版', | |||||
style: TextStyle( | |||||
fontSize: 16, | |||||
fontWeight: FontWeight.bold, | |||||
), | |||||
), | |||||
), | |||||
GoodsShareItem( | |||||
child: GoodsShareEdit( | |||||
'至高减600【24期免息】xiaomi/小米10Pro 5G手机骁龙865智能游戏拍照手机官方旗舰店小米10青春正品k305g现货\n\n原价】3999元\n券后价】3989元\n【用智莺生活再省】19.74元\n-------------\n復製(FRH51Lu9hYF),\n用【Tao·寳】下单\n-------------\n商品链接】\nhttp://hsrj3.cn/ps/FRH51Lu9hYF.html)\n', | |||||
), | |||||
), | |||||
Padding( | |||||
padding: const EdgeInsets.only(top: 8), | |||||
child: Row( | |||||
mainAxisAlignment: MainAxisAlignment.center, | |||||
children: <Widget>[ | |||||
Container( | |||||
margin: EdgeInsets.only(left: 5), | |||||
width: 110, | |||||
height: 36, | |||||
decoration: BoxDecoration( | |||||
color: Colors.orangeAccent, | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
child: Center( | |||||
child: Text( | |||||
'返回编辑', | |||||
style: TextStyle(color: Colors.white), | |||||
), | |||||
), | |||||
), | |||||
Container( | |||||
margin: EdgeInsets.only(left: 40), | |||||
width: 110, | |||||
height: 36, | |||||
decoration: BoxDecoration( | |||||
color: Colors.orangeAccent, | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
child: Center( | |||||
child: Text( | |||||
'保存模板', | |||||
style: TextStyle(color: Colors.white), | |||||
), | |||||
), | |||||
), | |||||
], | |||||
), | |||||
), | |||||
], | |||||
), | |||||
), | |||||
), | |||||
], | |||||
), | |||||
), | |||||
), | |||||
); | |||||
} | |||||
} |
@@ -1,4 +1,6 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:fluttertoast/fluttertoast.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_editor/goods_share_editor.dart'; | |||||
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/good_share_msg.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/widgets/good_share_msg.dart'; | ||||
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_edit.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_edit.dart'; | ||||
import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_item.dart'; | import 'package:zhiying_base_widget/pages/goods_share_page/widgets/goods_share_item.dart'; | ||||
@@ -20,7 +22,17 @@ class _GoodsShareImageState extends State<GoodsShareImage> { | |||||
children: <Widget>[ | children: <Widget>[ | ||||
GoodsShareItem( | GoodsShareItem( | ||||
child: GoodsShareEdit( | child: GoodsShareEdit( | ||||
'至高减600【24期免息】xiaomi/小米10Pro 5G手机骁龙865智能游戏拍照手机官方旗舰店小米10青春正品k305g现货\n\n原价】3999元\n券后价】3989元\n【用智莺生活再省】19.74元\n-------------\n復製(FRH51Lu9hYF),\n用【Tao·寳】下单\n-------------\n商品链接】\nhttp://hsrj3.cn/ps/FRH51Lu9hYF.html)\n'), | |||||
'至高减600【24期免息】xiaomi/小米10Pro 5G手机骁龙865智能游戏拍照手机官方旗舰店小米10青春正品k305g现货\n\n原价】3999元\n券后价】3989元\n【用智莺生活再省】19.74元\n-------------\n復製(FRH51Lu9hYF),\n用【Tao·寳】下单\n-------------\n商品链接】\nhttp://hsrj3.cn/ps/FRH51Lu9hYF.html)\n', | |||||
onCopyClick: () { | |||||
Fluttertoast.showToast(msg: '复制成功'); | |||||
}, | |||||
onEditorClick: () { | |||||
Navigator.push( | |||||
context, | |||||
MaterialPageRoute( | |||||
builder: (context) => GoodsShareEditor())); | |||||
}, | |||||
), | |||||
), | ), | ||||
GoodsShareItem( | GoodsShareItem( | ||||
child: GoodsShareMessage('点击编辑模板可以自定义分享文案哦😄😄'), | child: GoodsShareMessage('点击编辑模板可以自定义分享文案哦😄😄'), | ||||
@@ -2,8 +2,12 @@ import 'package:flutter/material.dart'; | |||||
class GoodsShareEdit extends StatelessWidget { | class GoodsShareEdit extends StatelessWidget { | ||||
final String message; | final String message; | ||||
final VoidCallback onEditorClick; | |||||
final VoidCallback onCopyClick; | |||||
const GoodsShareEdit(this.message, {Key key}) : super(key: key); | |||||
const GoodsShareEdit(this.message, | |||||
{Key key, this.onEditorClick, this.onCopyClick}) | |||||
: super(key: key); | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
@@ -62,9 +66,15 @@ class GoodsShareEdit extends StatelessWidget { | |||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Expanded( | Expanded( | ||||
child: GoodsShareCheckButton( | |||||
'编辑模版', | |||||
isSelected: true, | |||||
child: GestureDetector( | |||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: GoodsShareCheckButton( | |||||
'编辑模版', | |||||
isSelected: true, | |||||
), | |||||
), | |||||
onTap: onEditorClick, | |||||
), | ), | ||||
), | ), | ||||
Container( | Container( | ||||
@@ -73,9 +83,15 @@ class GoodsShareEdit extends StatelessWidget { | |||||
color: Color(0xffececec), | color: Color(0xffececec), | ||||
), | ), | ||||
Expanded( | Expanded( | ||||
child: GoodsShareCheckButton( | |||||
'复制文案', | |||||
isSelected: false, | |||||
child: GestureDetector( | |||||
child: Container( | |||||
color: Colors.transparent, | |||||
child: GoodsShareCheckButton( | |||||
'复制文案', | |||||
isSelected: false, | |||||
), | |||||
), | |||||
onTap: onCopyClick, | |||||
), | ), | ||||
), | ), | ||||
], | ], | ||||
@@ -125,7 +125,10 @@ class _ShareAlertContent extends StatelessWidget { | |||||
padding: const EdgeInsets.only(top: 2, bottom: 2), | padding: const EdgeInsets.only(top: 2, bottom: 2), | ||||
child: Text( | child: Text( | ||||
'分享平台', | '分享平台', | ||||
style: TextStyle(fontSize: 12, color: Color(0xff333333)), | |||||
style: TextStyle( | |||||
fontSize: 12, | |||||
color: Color(0xff333333), | |||||
fontWeight: FontWeight.bold), | |||||
), | ), | ||||
), | ), | ||||
], | ], | ||||