소스 검색

更新模板预览

tags/0.0.1
Weller 4 년 전
부모
커밋
6aeb3ccf08
5개의 변경된 파일372개의 추가작업 그리고 9개의 파일을 삭제
  1. +230
    -0
      lib/pages/goods_share_page/goods_share_editor/goods_share_editor.dart
  2. +102
    -0
      lib/pages/goods_share_page/goods_share_editor/goods_share_preview.dart
  3. +13
    -1
      lib/pages/goods_share_page/goods_share_image/goods_share_image.dart
  4. +23
    -7
      lib/pages/goods_share_page/widgets/goods_share_edit.dart
  5. +4
    -1
      lib/widgets/share/share_alert.dart

+ 230
- 0
lib/pages/goods_share_page/goods_share_editor/goods_share_editor.dart 파일 보기

@@ -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(),
);
}
}

+ 102
- 0
lib/pages/goods_share_page/goods_share_editor/goods_share_preview.dart 파일 보기

@@ -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),
),
),
),
],
),
),
],
),
),
),
],
),
),
),
);
}
}

+ 13
- 1
lib/pages/goods_share_page/goods_share_image/goods_share_image.dart 파일 보기

@@ -1,4 +1,6 @@
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/goods_share_edit.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>[
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'),
'至高减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(
child: GoodsShareMessage('点击编辑模板可以自定义分享文案哦😄😄'),


+ 23
- 7
lib/pages/goods_share_page/widgets/goods_share_edit.dart 파일 보기

@@ -2,8 +2,12 @@ import 'package:flutter/material.dart';

class GoodsShareEdit extends StatelessWidget {
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
Widget build(BuildContext context) {
@@ -62,9 +66,15 @@ class GoodsShareEdit extends StatelessWidget {
child: Row(
children: <Widget>[
Expanded(
child: GoodsShareCheckButton(
'编辑模版',
isSelected: true,
child: GestureDetector(
child: Container(
color: Colors.transparent,
child: GoodsShareCheckButton(
'编辑模版',
isSelected: true,
),
),
onTap: onEditorClick,
),
),
Container(
@@ -73,9 +83,15 @@ class GoodsShareEdit extends StatelessWidget {
color: Color(0xffececec),
),
Expanded(
child: GoodsShareCheckButton(
'复制文案',
isSelected: false,
child: GestureDetector(
child: Container(
color: Colors.transparent,
child: GoodsShareCheckButton(
'复制文案',
isSelected: false,
),
),
onTap: onCopyClick,
),
),
],


+ 4
- 1
lib/widgets/share/share_alert.dart 파일 보기

@@ -125,7 +125,10 @@ class _ShareAlertContent extends StatelessWidget {
padding: const EdgeInsets.only(top: 2, bottom: 2),
child: Text(
'分享平台',
style: TextStyle(fontSize: 12, color: Color(0xff333333)),
style: TextStyle(
fontSize: 12,
color: Color(0xff333333),
fontWeight: FontWeight.bold),
),
),
],


불러오는 중...
취소
저장