|
@@ -12,6 +12,7 @@ import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
|
import 'bloc/wechat_teacher_event.dart'; |
|
|
import 'bloc/wechat_teacher_event.dart'; |
|
|
import 'bloc/wechat_teacher_state.dart'; |
|
|
import 'bloc/wechat_teacher_state.dart'; |
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
|
|
|
|
|
/// |
|
|
/// |
|
|
/// 微信导师 |
|
|
/// 微信导师 |
|
@@ -24,8 +25,7 @@ class WechatTeacherPage extends StatelessWidget { |
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
return BlocProvider<WechatTeacherBloc>( |
|
|
return BlocProvider<WechatTeacherBloc>( |
|
|
create: (_) => WechatTeacherBloc(WechatTeacherRepository(data)) |
|
|
|
|
|
..add(WechatTeacherInitEvent()), |
|
|
|
|
|
|
|
|
create: (_) => WechatTeacherBloc(WechatTeacherRepository(data))..add(WechatTeacherInitEvent()), |
|
|
child: _WechatTeacherPageContainer(), |
|
|
child: _WechatTeacherPageContainer(), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
@@ -33,12 +33,10 @@ class WechatTeacherPage extends StatelessWidget { |
|
|
|
|
|
|
|
|
class _WechatTeacherPageContainer extends StatefulWidget { |
|
|
class _WechatTeacherPageContainer extends StatefulWidget { |
|
|
@override |
|
|
@override |
|
|
_WechatTeacherPageContainerState createState() => |
|
|
|
|
|
_WechatTeacherPageContainerState(); |
|
|
|
|
|
|
|
|
_WechatTeacherPageContainerState createState() => _WechatTeacherPageContainerState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class _WechatTeacherPageContainerState |
|
|
|
|
|
extends State<_WechatTeacherPageContainer> { |
|
|
|
|
|
|
|
|
class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer> { |
|
|
TextEditingController _editingController; |
|
|
TextEditingController _editingController; |
|
|
|
|
|
|
|
|
/// 是否绑定中 |
|
|
/// 是否绑定中 |
|
@@ -55,24 +53,33 @@ class _WechatTeacherPageContainerState |
|
|
setState(() { |
|
|
setState(() { |
|
|
_isBinding = true; |
|
|
_isBinding = true; |
|
|
}); |
|
|
}); |
|
|
BlocProvider.of<WechatTeacherBloc>(context) |
|
|
|
|
|
.add(WechatTeacherBindEvent(teacherWxChat: wxAccount)); |
|
|
|
|
|
|
|
|
BlocProvider.of<WechatTeacherBloc>(context).add(WechatTeacherBindEvent(teacherWxChat: wxAccount)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// 拷贝 |
|
|
/// 拷贝 |
|
|
void _copyText(String text) { |
|
|
|
|
|
|
|
|
void _copyText(String text) async { |
|
|
if (!EmptyUtil.isEmpty(text)) { |
|
|
if (!EmptyUtil.isEmpty(text)) { |
|
|
Clipboard.setData(ClipboardData(text: text)); |
|
|
|
|
|
|
|
|
await Clipboard.setData(ClipboardData(text: text)); |
|
|
Fluttertoast.showToast(msg: '复制成功~'); |
|
|
Fluttertoast.showToast(msg: '复制成功~'); |
|
|
|
|
|
String url = "weixin://"; |
|
|
|
|
|
if (await canLaunch(url)) { |
|
|
|
|
|
await launch(url); |
|
|
|
|
|
} else { |
|
|
|
|
|
throw 'Could not launch $url'; |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
Fluttertoast.showToast(msg: '内容不能为空~'); |
|
|
Fluttertoast.showToast(msg: '内容不能为空~'); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// 长按保存图片 |
|
|
/// 长按保存图片 |
|
|
void _longClickSaveImage() { |
|
|
|
|
|
|
|
|
void _longClickSaveImage(String url) async { |
|
|
Logger.log('长按保存图片'); |
|
|
Logger.log('长按保存图片'); |
|
|
|
|
|
if (!EmptyUtil.isEmpty(url)) { |
|
|
|
|
|
var msg = await Download().fileToGallery(url); |
|
|
|
|
|
Fluttertoast.showToast(msg: msg); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
@@ -115,8 +122,7 @@ class _WechatTeacherPageContainerState |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Widget _createMainWidget( |
|
|
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
|
|
|
|
|
Widget _createMainWidget(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
return Scaffold( |
|
|
return Scaffold( |
|
|
appBar: _createNav(styleModel), |
|
|
appBar: _createNav(styleModel), |
|
|
backgroundColor: HexColor.fromHex(styleModel?.bgColor ?? '#FFF5F5F5'), |
|
|
backgroundColor: HexColor.fromHex(styleModel?.bgColor ?? '#FFF5F5F5'), |
|
@@ -184,8 +190,7 @@ class _WechatTeacherPageContainerState |
|
|
child: CupertinoTextField( |
|
|
child: CupertinoTextField( |
|
|
onSubmitted: (val) => _bindTeacher(), |
|
|
onSubmitted: (val) => _bindTeacher(), |
|
|
controller: _editingController, |
|
|
controller: _editingController, |
|
|
placeholder: styleModel?.nobindTeacherDialog?.inputHintText ?? |
|
|
|
|
|
'请填写邀请人邀请码/手机号码', |
|
|
|
|
|
|
|
|
placeholder: styleModel?.nobindTeacherDialog?.inputHintText ?? '请填写邀请人邀请码/手机号码', |
|
|
placeholderStyle: TextStyle(fontSize: 14), |
|
|
placeholderStyle: TextStyle(fontSize: 14), |
|
|
decoration: BoxDecoration(), |
|
|
decoration: BoxDecoration(), |
|
|
), |
|
|
), |
|
@@ -202,19 +207,14 @@ class _WechatTeacherPageContainerState |
|
|
width: 130, |
|
|
width: 130, |
|
|
height: 30, |
|
|
height: 30, |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.commStyle?.btnBgColor ?? '#FF5A5A'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.commStyle?.btnBgColor ?? '#FF5A5A'), |
|
|
borderRadius: BorderRadius.circular(15), |
|
|
borderRadius: BorderRadius.circular(15), |
|
|
), |
|
|
), |
|
|
child: Center( |
|
|
child: Center( |
|
|
child: Text( |
|
|
child: Text( |
|
|
_isBinding |
|
|
|
|
|
? '绑定中...' |
|
|
|
|
|
: styleModel?.nobindTeacherDialog?.btnText ?? '绑定邀请人', |
|
|
|
|
|
|
|
|
_isBinding ? '绑定中...' : styleModel?.nobindTeacherDialog?.btnText ?? '绑定邀请人', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.commStyle?.btnTextColor ?? '#FFFFFFF'), |
|
|
|
|
|
fontSize: 14), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.commStyle?.btnTextColor ?? '#FFFFFFF'), fontSize: 14), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
@@ -225,8 +225,7 @@ class _WechatTeacherPageContainerState |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// 绑定的UI |
|
|
/// 绑定的UI |
|
|
Widget _createBindWidget( |
|
|
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
|
|
|
|
|
Widget _createBindWidget(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
return Container( |
|
|
return Container( |
|
|
width: double.infinity, |
|
|
width: double.infinity, |
|
|
height: double.infinity, |
|
|
height: double.infinity, |
|
@@ -249,35 +248,25 @@ class _WechatTeacherPageContainerState |
|
|
children: <Widget>[ |
|
|
children: <Widget>[ |
|
|
Text(dataModel?.teacherUsername ?? '', |
|
|
Text(dataModel?.teacherUsername ?? '', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 15, |
|
|
|
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.teacherDialogTitleColor ?? '#3C3C3C'))), |
|
|
|
|
|
|
|
|
fontSize: 15, color: HexColor.fromHex(styleModel?.teacherDialogTitleColor ?? '#3C3C3C'))), |
|
|
Text('微信号: ${dataModel?.teacherWechatAccount ?? ''}', |
|
|
Text('微信号: ${dataModel?.teacherWechatAccount ?? ''}', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 15, |
|
|
|
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.commStyle?.wechatAccountColor ?? |
|
|
|
|
|
'#FF5050'))), |
|
|
|
|
|
|
|
|
fontSize: 15, color: HexColor.fromHex(styleModel?.commStyle?.wechatAccountColor ?? '#FF5050'))), |
|
|
GestureDetector( |
|
|
GestureDetector( |
|
|
onTap: () => _copyText(dataModel?.teacherWechatAccount), |
|
|
onTap: () => _copyText(dataModel?.teacherWechatAccount), |
|
|
child: UnconstrainedBox( |
|
|
child: UnconstrainedBox( |
|
|
child: Container( |
|
|
child: Container( |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
// color: Color(0xffffdada), |
|
|
// color: Color(0xffffdada), |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.bindTeacherDialog?.btnBgColor ?? |
|
|
|
|
|
'#FFDADA'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.bindTeacherDialog?.btnBgColor ?? '#FFDADA'), |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
borderRadius: BorderRadius.circular(20), |
|
|
), |
|
|
), |
|
|
padding: |
|
|
|
|
|
EdgeInsets.only(left: 9, right: 9, top: 4, bottom: 4), |
|
|
|
|
|
|
|
|
padding: EdgeInsets.only(left: 9, right: 9, top: 4, bottom: 4), |
|
|
child: Text( |
|
|
child: Text( |
|
|
styleModel?.bindTeacherDialog?.btnText ?? '复制去微信添加', |
|
|
styleModel?.bindTeacherDialog?.btnText ?? '复制去微信添加', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 13, |
|
|
fontSize: 13, |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.bindTeacherDialog?.btnTextColor ?? |
|
|
|
|
|
'#FF0000')), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.bindTeacherDialog?.btnTextColor ?? '#FF0000')), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
@@ -288,7 +277,8 @@ class _WechatTeacherPageContainerState |
|
|
child: Align( |
|
|
child: Align( |
|
|
alignment: Alignment.centerRight, |
|
|
alignment: Alignment.centerRight, |
|
|
child: GestureDetector( |
|
|
child: GestureDetector( |
|
|
onLongPress: () => _longClickSaveImage(), |
|
|
|
|
|
|
|
|
onLongPress: () => _longClickSaveImage( |
|
|
|
|
|
dataModel?.teacherWxQrCode ?? styleModel?.myTeacher?.defalutTeacher?.qrcode ?? ''), |
|
|
child: Column( |
|
|
child: Column( |
|
|
children: <Widget>[ |
|
|
children: <Widget>[ |
|
|
Container( |
|
|
Container( |
|
@@ -296,9 +286,7 @@ class _WechatTeacherPageContainerState |
|
|
height: 56, |
|
|
height: 56, |
|
|
// color: Colors.red, |
|
|
// color: Colors.red, |
|
|
child: CachedNetworkImage( |
|
|
child: CachedNetworkImage( |
|
|
imageUrl: dataModel?.teacherWxQrCode ?? |
|
|
|
|
|
styleModel?.myTeacher?.defalutTeacher?.qrcode ?? |
|
|
|
|
|
'', |
|
|
|
|
|
|
|
|
imageUrl: dataModel?.teacherWxQrCode ?? styleModel?.myTeacher?.defalutTeacher?.qrcode ?? '', |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
const SizedBox(height: 9), |
|
|
const SizedBox(height: 9), |
|
@@ -306,9 +294,7 @@ class _WechatTeacherPageContainerState |
|
|
styleModel?.officalWxchat?.qrcodeText ?? '长按保存二维码', |
|
|
styleModel?.officalWxchat?.qrcodeText ?? '长按保存二维码', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 13, |
|
|
fontSize: 13, |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.officalWxchat?.qrcodeTextColor ?? |
|
|
|
|
|
'#999999')), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.officalWxchat?.qrcodeTextColor ?? '#999999')), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
@@ -320,8 +306,7 @@ class _WechatTeacherPageContainerState |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Widget _createHeader( |
|
|
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
|
|
|
|
|
Widget _createHeader(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
return Container( |
|
|
return Container( |
|
|
width: double.infinity, |
|
|
width: double.infinity, |
|
|
height: 283, |
|
|
height: 283, |
|
@@ -347,8 +332,7 @@ class _WechatTeacherPageContainerState |
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
padding: EdgeInsets.all(12), |
|
|
padding: EdgeInsets.all(12), |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.teacherDialogBgColor ?? '#FFFFFF'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.teacherDialogBgColor ?? '#FFFFFF'), |
|
|
borderRadius: BorderRadius.circular(10), |
|
|
borderRadius: BorderRadius.circular(10), |
|
|
), |
|
|
), |
|
|
child: Column( |
|
|
child: Column( |
|
@@ -360,8 +344,7 @@ class _WechatTeacherPageContainerState |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontWeight: FontWeight.bold, |
|
|
fontWeight: FontWeight.bold, |
|
|
fontSize: 15, |
|
|
fontSize: 15, |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.teacherDialogTitleColor ?? '#3C3C3C'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.teacherDialogTitleColor ?? '#3C3C3C'), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Expanded( |
|
|
Expanded( |
|
@@ -386,8 +369,7 @@ class _WechatTeacherPageContainerState |
|
|
margin: EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 22), |
|
|
margin: EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 22), |
|
|
padding: EdgeInsets.all(12), |
|
|
padding: EdgeInsets.all(12), |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: |
|
|
|
|
|
HexColor.fromHex(styleModel?.officalWxchat?.bgColor ?? '#FFFFFF'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.officalWxchat?.bgColor ?? '#FFFFFF'), |
|
|
borderRadius: BorderRadius.circular(10), |
|
|
borderRadius: BorderRadius.circular(10), |
|
|
), |
|
|
), |
|
|
child: Column( |
|
|
child: Column( |
|
@@ -397,8 +379,7 @@ class _WechatTeacherPageContainerState |
|
|
Text( |
|
|
Text( |
|
|
styleModel?.officalWxchat?.title ?? '官方微信', |
|
|
styleModel?.officalWxchat?.title ?? '官方微信', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
color: HexColor.fromHex( |
|
|
|
|
|
styleModel?.officalWxchat?.titleColor ?? '#3C3C3C'), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(styleModel?.officalWxchat?.titleColor ?? '#3C3C3C'), |
|
|
fontSize: 15, |
|
|
fontSize: 15, |
|
|
fontWeight: FontWeight.bold, |
|
|
fontWeight: FontWeight.bold, |
|
|
), |
|
|
), |
|
@@ -416,10 +397,7 @@ class _WechatTeacherPageContainerState |
|
|
styleModel.officalWxchat.list.forEach((element) { |
|
|
styleModel.officalWxchat.list.forEach((element) { |
|
|
widgets.add(WechatTeachetItem(element, styleModel)); |
|
|
widgets.add(WechatTeachetItem(element, styleModel)); |
|
|
widgets.add(Container( |
|
|
widgets.add(Container( |
|
|
margin: EdgeInsets.only(top: 4, bottom: 4), |
|
|
|
|
|
width: double.infinity, |
|
|
|
|
|
height: 0.5, |
|
|
|
|
|
color: Color(0xffebebeb))); |
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(top: 4, bottom: 4), width: double.infinity, height: 0.5, color: Color(0xffebebeb))); |
|
|
}); |
|
|
}); |
|
|
widgets.removeLast(); |
|
|
widgets.removeLast(); |
|
|
} else { |
|
|
} else { |
|
|