|
|
@@ -1,17 +1,17 @@ |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
|
import 'package:fluttertoast/fluttertoast.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/wechat_teacher_page/bloc/wechat_teacher_bloc.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/wechat_teacher_page/bloc/wechat_teacher_repository.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/wechat_teacher_page/model/wechat_teacher_data_model.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/wechat_teacher_page/model/wechat_teacher_style_model.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/wechat_teacher_page/widgets/wechat_teacher_item.dart'; |
|
|
|
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
|
import 'bloc/wechat_teacher_state.dart'; |
|
|
|
|
|
|
|
import 'bloc/wechat_teacher_event.dart'; |
|
|
|
import 'package:fluttertoast/fluttertoast.dart'; |
|
|
|
import 'bloc/wechat_teacher_state.dart'; |
|
|
|
|
|
|
|
/// |
|
|
|
/// 微信导师 |
|
|
@@ -24,7 +24,8 @@ class WechatTeacherPage extends StatelessWidget { |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocProvider<WechatTeacherBloc>( |
|
|
|
create: (_) => WechatTeacherBloc(WechatTeacherRepository(data))..add(WechatTeacherInitEvent()), |
|
|
|
create: (_) => WechatTeacherBloc(WechatTeacherRepository(data)) |
|
|
|
..add(WechatTeacherInitEvent()), |
|
|
|
child: _WechatTeacherPageContainer(), |
|
|
|
); |
|
|
|
} |
|
|
@@ -32,10 +33,12 @@ class WechatTeacherPage extends StatelessWidget { |
|
|
|
|
|
|
|
class _WechatTeacherPageContainer extends StatefulWidget { |
|
|
|
@override |
|
|
|
_WechatTeacherPageContainerState createState() => _WechatTeacherPageContainerState(); |
|
|
|
_WechatTeacherPageContainerState createState() => |
|
|
|
_WechatTeacherPageContainerState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer> { |
|
|
|
class _WechatTeacherPageContainerState |
|
|
|
extends State<_WechatTeacherPageContainer> { |
|
|
|
TextEditingController _editingController; |
|
|
|
|
|
|
|
/// 是否绑定中 |
|
|
@@ -52,7 +55,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
setState(() { |
|
|
|
_isBinding = true; |
|
|
|
}); |
|
|
|
BlocProvider.of<WechatTeacherBloc>(context).add(WechatTeacherBindEvent(teacherWxChat: wxAccount)); |
|
|
|
BlocProvider.of<WechatTeacherBloc>(context) |
|
|
|
.add(WechatTeacherBindEvent(teacherWxChat: wxAccount)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -111,7 +115,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
Widget _createMainWidget(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
Widget _createMainWidget( |
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
return Scaffold( |
|
|
|
appBar: _createNav(styleModel), |
|
|
|
backgroundColor: HexColor.fromHex(styleModel?.bgColor ?? '#FFF5F5F5'), |
|
|
@@ -119,7 +124,7 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
child: SingleChildScrollView( |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
_createHeader(styleModel,dataModel), |
|
|
|
_createHeader(styleModel, dataModel), |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 15), |
|
|
|
child: CachedNetworkImage( |
|
|
@@ -179,7 +184,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
child: CupertinoTextField( |
|
|
|
onSubmitted: (val) => _bindTeacher(), |
|
|
|
controller: _editingController, |
|
|
|
placeholder: styleModel?.nobindTeacherDialog?.inputHintText ?? '请填写邀请人邀请码/手机号码', |
|
|
|
placeholder: styleModel?.nobindTeacherDialog?.inputHintText ?? |
|
|
|
'请填写邀请人邀请码/手机号码', |
|
|
|
placeholderStyle: TextStyle(fontSize: 14), |
|
|
|
decoration: BoxDecoration(), |
|
|
|
), |
|
|
@@ -196,13 +202,19 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
width: 130, |
|
|
|
height: 30, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(styleModel?.commStyle?.btnBgColor ?? '#FF5A5A'), |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.commStyle?.btnBgColor ?? '#FF5A5A'), |
|
|
|
borderRadius: BorderRadius.circular(15), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
_isBinding ? '绑定中...' : styleModel?.nobindTeacherDialog?.btnText ?? '绑定邀请人', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.commStyle?.btnTextColor ?? '#FFFFFFF'), fontSize: 14), |
|
|
|
_isBinding |
|
|
|
? '绑定中...' |
|
|
|
: styleModel?.nobindTeacherDialog?.btnText ?? '绑定邀请人', |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.commStyle?.btnTextColor ?? '#FFFFFFF'), |
|
|
|
fontSize: 14), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@@ -213,7 +225,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
} |
|
|
|
|
|
|
|
/// 绑定的UI |
|
|
|
Widget _createBindWidget(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
Widget _createBindWidget( |
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
height: double.infinity, |
|
|
@@ -224,28 +237,47 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
width: 50, |
|
|
|
height: 50, |
|
|
|
// color: Colors.red, |
|
|
|
child: CircleAvatar(child: CachedNetworkImage(imageUrl: dataModel?.teacherAvatar ??'',)), |
|
|
|
child: CircleAvatar( |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: dataModel?.teacherAvatar ?? '', |
|
|
|
)), |
|
|
|
), |
|
|
|
const SizedBox(width: 13), |
|
|
|
Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
children: <Widget>[ |
|
|
|
Text(dataModel?.teacherUsername ??'', style: TextStyle(fontSize: 15, color: HexColor.fromHex(styleModel?.teacherDialogTitleColor ?? '#3C3C3C'))), |
|
|
|
Text('微信号: ${dataModel?.teacherWechatAccount??''}', style: TextStyle(fontSize: 15, color: HexColor.fromHex(styleModel?.commStyle.wechatAccountColor ?? '#FF5050'))), |
|
|
|
Text(dataModel?.teacherUsername ?? '', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15, |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.teacherDialogTitleColor ?? '#3C3C3C'))), |
|
|
|
Text('微信号: ${dataModel?.teacherWechatAccount ?? ''}', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 15, |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.commStyle?.wechatAccountColor ?? |
|
|
|
'#FF5050'))), |
|
|
|
GestureDetector( |
|
|
|
onTap: () => _copyText(dataModel?.teacherWechatAccount), |
|
|
|
child: UnconstrainedBox( |
|
|
|
child: Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
// color: Color(0xffffdada), |
|
|
|
color: HexColor.fromHex(styleModel?.bindTeacherDialog?.btnBgColor ?? '#FFDADA'), |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.bindTeacherDialog?.btnBgColor ?? |
|
|
|
'#FFDADA'), |
|
|
|
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( |
|
|
|
styleModel?.bindTeacherDialog?.btnText ?? '复制去微信添加', |
|
|
|
style: TextStyle(fontSize: 13, color: HexColor.fromHex(styleModel?.bindTeacherDialog?.btnTextColor ?? '#FF0000')), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.bindTeacherDialog?.btnTextColor ?? |
|
|
|
'#FF0000')), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@@ -264,13 +296,19 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
height: 56, |
|
|
|
// color: Colors.red, |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: dataModel?.teacherWxQrCode ?? styleModel?.myTeacher?.defalutTeacher?.qrcode ?? '', |
|
|
|
imageUrl: dataModel?.teacherWxQrCode ?? |
|
|
|
styleModel?.myTeacher?.defalutTeacher?.qrcode ?? |
|
|
|
'', |
|
|
|
), |
|
|
|
), |
|
|
|
const SizedBox(height: 9), |
|
|
|
Text( |
|
|
|
styleModel?.officalWxchat?.qrcodeText ?? '长按保存二维码', |
|
|
|
style: TextStyle(fontSize: 13, color: HexColor.fromHex(styleModel?.officalWxchat?.qrcodeTextColor ?? '#999999')), |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.officalWxchat?.qrcodeTextColor ?? |
|
|
|
'#999999')), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
@@ -282,7 +320,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
Widget _createHeader(WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
Widget _createHeader( |
|
|
|
WechatTeacherStyleModel styleModel, WechatTeacherDataModel dataModel) { |
|
|
|
return Container( |
|
|
|
width: double.infinity, |
|
|
|
height: 283, |
|
|
@@ -308,7 +347,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(styleModel?.teacherDialogBgColor ?? '#FFFFFF'), |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.teacherDialogBgColor ?? '#FFFFFF'), |
|
|
|
borderRadius: BorderRadius.circular(10), |
|
|
|
), |
|
|
|
child: Column( |
|
|
@@ -320,7 +360,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontSize: 15, |
|
|
|
color: HexColor.fromHex(styleModel?.teacherDialogTitleColor ?? '#3C3C3C'), |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.teacherDialogTitleColor ?? '#3C3C3C'), |
|
|
|
), |
|
|
|
), |
|
|
|
Expanded( |
|
|
@@ -345,7 +386,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
margin: EdgeInsets.only(left: 10, right: 10, top: 0, bottom: 22), |
|
|
|
padding: EdgeInsets.all(12), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(styleModel?.officalWxchat?.bgColor ?? '#FFFFFF'), |
|
|
|
color: |
|
|
|
HexColor.fromHex(styleModel?.officalWxchat?.bgColor ?? '#FFFFFF'), |
|
|
|
borderRadius: BorderRadius.circular(10), |
|
|
|
), |
|
|
|
child: Column( |
|
|
@@ -355,7 +397,8 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
Text( |
|
|
|
styleModel?.officalWxchat?.title ?? '官方微信', |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex(styleModel?.officalWxchat?.titleColor ?? '#3C3C3C'), |
|
|
|
color: HexColor.fromHex( |
|
|
|
styleModel?.officalWxchat?.titleColor ?? '#3C3C3C'), |
|
|
|
fontSize: 15, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
), |
|
|
@@ -372,7 +415,11 @@ class _WechatTeacherPageContainerState extends State<_WechatTeacherPageContainer |
|
|
|
if (length > 0) { |
|
|
|
styleModel.officalWxchat.list.forEach((element) { |
|
|
|
widgets.add(WechatTeachetItem(element, styleModel)); |
|
|
|
widgets.add(Container(margin: EdgeInsets.only(top: 4, bottom: 4), width: double.infinity, height: 0.5, color: Color(0xffebebeb))); |
|
|
|
widgets.add(Container( |
|
|
|
margin: EdgeInsets.only(top: 4, bottom: 4), |
|
|
|
width: double.infinity, |
|
|
|
height: 0.5, |
|
|
|
color: Color(0xffebebeb))); |
|
|
|
}); |
|
|
|
widgets.removeLast(); |
|
|
|
} else { |
|
|
|