@@ -650,7 +650,7 @@ | |||||
"languageVersion": "2.8" | "languageVersion": "2.8" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-11-17T09:51:34.034604Z", | |||||
"generated": "2020-11-18T05:43:02.817433Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.8.2" | "generatorVersion": "2.8.2" | ||||
} | } |
@@ -1,25 +1,12 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_dialog_model.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class PolicyConfirmDialog extends StatefulWidget { | |||||
@override | |||||
_PolicyConfirmDialogState createState() => _PolicyConfirmDialogState(); | |||||
} | |||||
class PolicyConfirmDialog extends StatelessWidget { | |||||
final PolicyDialogModel model; | |||||
class _PolicyConfirmDialogState extends State<PolicyConfirmDialog> { | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return _PolicyConfirmDialogContainer(); | |||||
} | |||||
} | |||||
const PolicyConfirmDialog(this.model, {Key key}) : super(key: key); | |||||
class _PolicyConfirmDialogContainer extends StatefulWidget { | |||||
@override | |||||
_PolicyConfirmDialogContainerState createState() => | |||||
_PolicyConfirmDialogContainerState(); | |||||
} | |||||
class _PolicyConfirmDialogContainerState | |||||
extends State<_PolicyConfirmDialogContainer> { | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Scaffold( | return Scaffold( | ||||
@@ -34,12 +21,21 @@ class _PolicyConfirmDialogContainerState | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Text( | Text( | ||||
'温馨提示', | |||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), | |||||
model?.title ?? '', | |||||
style: TextStyle( | |||||
fontSize: 16, | |||||
fontWeight: FontWeight.bold, | |||||
color: HexColor.fromHex(model?.titleColor ?? '#333333')), | |||||
), | ), | ||||
Padding( | Padding( | ||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), | padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), | ||||
child: Text('若得不到您的同意,我们将无法继续为您服务哦,您要不要在想想?'), | |||||
child: Text( | |||||
model?.content ?? '', | |||||
style: TextStyle( | |||||
fontSize: 12, | |||||
color: HexColor.fromHex(model?.contentColor ?? '#555555'), | |||||
), | |||||
), | |||||
), | ), | ||||
Row( | Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
@@ -50,8 +46,20 @@ class _PolicyConfirmDialogContainerState | |||||
}, | }, | ||||
child: Container( | child: Container( | ||||
height: 36, | height: 36, | ||||
color: Colors.redAccent, | |||||
child: Text('仍不同意'), | |||||
child: Center( | |||||
child: Text( | |||||
model?.leftBfnText ?? '', | |||||
style: TextStyle( | |||||
color: HexColor.fromHex( | |||||
model?.leftBfnTextColor ?? '')), | |||||
), | |||||
), | |||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex( | |||||
model?.leftBfnBgColor ?? '#ffffff'), | |||||
borderRadius: BorderRadius.circular(18), | |||||
border: Border.all( | |||||
color: Color(0xffd8d8d8), width: 1)), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -65,10 +73,22 @@ class _PolicyConfirmDialogContainerState | |||||
}, | }, | ||||
child: Container( | child: Container( | ||||
height: 36, | height: 36, | ||||
color: Colors.redAccent, | |||||
child: Center( | |||||
child: Text( | |||||
model?.rightBfnText ?? '', | |||||
style: TextStyle( | |||||
color: HexColor.fromHex( | |||||
model?.rightBfnTextColor ?? '')), | |||||
), | |||||
), | |||||
decoration: BoxDecoration( | |||||
color: | |||||
HexColor.fromHex(model?.rightBfnBgColor ?? ''), | |||||
borderRadius: BorderRadius.circular(18), | |||||
), | |||||
), | ), | ||||
), | ), | ||||
) | |||||
), | |||||
], | ], | ||||
) | ) | ||||
], | ], | ||||
@@ -12,9 +12,9 @@ class PolicyDialog extends StatefulWidget { | |||||
static Future<bool> show(BuildContext context) async { | static Future<bool> show(BuildContext context) async { | ||||
Map json = | Map json = | ||||
await NetUtil.post('/api/v1/app/permissions', method: NetMethod.GET); | |||||
await NetUtil.post('/api/v1/app/permissions', method: NetMethod.GET); | |||||
PolicyDialogModel model = | PolicyDialogModel model = | ||||
PolicyDialogModel.fromJson(Map<String, dynamic>.from(json['data'])); | |||||
PolicyDialogModel.fromJson(Map<String, dynamic>.from(json['data'])); | |||||
bool agree = null; | bool agree = null; | ||||
while (agree == null) { | while (agree == null) { | ||||
agree = await showCupertinoDialog( | agree = await showCupertinoDialog( | ||||
@@ -26,7 +26,8 @@ class PolicyDialog extends StatefulWidget { | |||||
bool accept = null; | bool accept = null; | ||||
while (accept == null) { | while (accept == null) { | ||||
accept = await showCupertinoDialog( | accept = await showCupertinoDialog( | ||||
context: context, builder: (_) => PolicyConfirmDialog()); | |||||
context: context, | |||||
builder: (_) => PolicyConfirmDialog(model.subDialog)); | |||||
} | } | ||||
return accept; | return accept; | ||||
} | } | ||||
@@ -83,7 +84,7 @@ class _PolicyDialogState extends State<PolicyDialog> { | |||||
widget.model?.leftBfnBgColor ?? '#ffffff'), | widget.model?.leftBfnBgColor ?? '#ffffff'), | ||||
borderRadius: BorderRadius.circular(18), | borderRadius: BorderRadius.circular(18), | ||||
border: | border: | ||||
Border.all(color: Color(0xffd8d8d8), width: 1)), | |||||
Border.all(color: Color(0xffd8d8d8), width: 1)), | |||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
@@ -123,47 +124,62 @@ class _PolicyDialogState extends State<PolicyDialog> { | |||||
} | } | ||||
Widget _createText() { | Widget _createText() { | ||||
String content = widget.model?.content ?? ''; | |||||
Map<int, PolicyItemModel> replaces = Map(); | |||||
List<int> indexs = List(); | |||||
widget.model?.selectedText?.forEach((replace) { | |||||
int index = content.indexOf(replace.key); | |||||
indexs.add(index); | |||||
replaces[index] = replace; | |||||
// Logger.debug(replace.key); | |||||
}); | |||||
// 倒序,从后面开始替换 | |||||
indexs.sort((a, b) { | |||||
return b.compareTo(a); | |||||
}); | |||||
List<TextSpan> texts = List(); | |||||
int end = content.length - 1; | |||||
for (int index in indexs) { | |||||
// Logger.debug(index); | |||||
PolicyItemModel replace = replaces[index]; | |||||
texts.insert(0, | |||||
TextSpan( | |||||
text: content.substring(index + replace.key.length, end), | |||||
), | |||||
); | |||||
texts.insert(0, | |||||
TextSpan( | |||||
text: replace?.text ?? '', | |||||
recognizer: TapGestureRecognizer() | |||||
..onTap = () { | |||||
NativeUtil.openUrl(context, replace?.url ?? ''); | |||||
}, | |||||
style: TextStyle( | |||||
color: HexColor.fromHex(widget.model?.selectedColor ?? '#FF4242'), | |||||
), | |||||
), | |||||
); | |||||
end = index; | |||||
} | |||||
if (end != 0) { | |||||
texts.insert(0, | |||||
TextSpan( | |||||
text: content.substring(0, end), | |||||
), | |||||
); | |||||
} | |||||
return RichText( | return RichText( | ||||
textAlign: TextAlign.left, | textAlign: TextAlign.left, | ||||
text: TextSpan( | text: TextSpan( | ||||
text: '', | |||||
style: TextStyle( | |||||
height: 1.2, | |||||
fontSize: 12, | |||||
color: HexColor.fromHex('#555555'), | |||||
), | |||||
children: [ | |||||
TextSpan( | |||||
text: '亲爱的用户,感谢您对智莺生活的信任!\n\n我们根据最新的监管政策要求,我们更新了', | |||||
), | |||||
TextSpan( | |||||
text: '《用户协议》', | |||||
recognizer: TapGestureRecognizer() | |||||
..onTap = () { | |||||
NativeUtil.openUrl(context, 'http://www.baidu.com'); | |||||
}, | |||||
style: TextStyle( | |||||
color: HexColor.fromHex('#FF4242'), | |||||
), | |||||
), | |||||
TextSpan( | |||||
text: '和', | |||||
), | |||||
TextSpan( | |||||
text: '《隐私权政策》', | |||||
style: TextStyle( | |||||
color: HexColor.fromHex('#FF4242'), | |||||
), | |||||
recognizer: TapGestureRecognizer() | |||||
..onTap = () { | |||||
NativeUtil.openUrl(context, 'http://www.baidu.com'); | |||||
}, | |||||
), | |||||
TextSpan( | |||||
text: | |||||
',请您在点击「同意」之前仔细阅读并充分理解。\n\n为了提供更好的服务,我们在特此说明:\n\n1.在您授权通过的情况下,我们将获取您的设备、位置等信息。您有权拒绝或取消授权;\n\n2.系统的安全保障措施,会严密的保护您的个人信息;\n\n3.未经您本人授权同意,我们不会从任何第三方处获取您的信息,也不会预期分享您的信息。', | |||||
), | |||||
]), | |||||
text: '', | |||||
style: TextStyle( | |||||
height: 1.2, | |||||
fontSize: 12, | |||||
color: HexColor.fromHex('#555555'), | |||||
), | |||||
children: texts, | |||||
), | |||||
); | ); | ||||
} | } | ||||
} | } |
@@ -11,6 +11,7 @@ import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_di | |||||
import 'package:zhiying_base_widget/utils/contants.dart'; | import 'package:zhiying_base_widget/utils/contants.dart'; | ||||
import 'package:zhiying_comm/models/base/base_tab_model.dart'; | import 'package:zhiying_comm/models/base/base_tab_model.dart'; | ||||
import 'package:zhiying_comm/util/image_util.dart'; | import 'package:zhiying_comm/util/image_util.dart'; | ||||
import 'package:zhiying_comm/util/shared_prefe_util.dart'; | |||||
import 'package:zhiying_comm/util/update/app_update_util.dart'; | import 'package:zhiying_comm/util/update/app_update_util.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
@@ -41,12 +42,12 @@ class _HomePageState extends State<HomePage> { | |||||
AppUpdateUtil.updateApp(context); | AppUpdateUtil.updateApp(context); | ||||
TaobaoAuth.initAuth(context); | TaobaoAuth.initAuth(context); | ||||
// SharedPreferencesUtil.getStringValue(Constants.isShowPolicy).then((value) { | |||||
// Logger.debug(value); | |||||
// if (value == null || value == '') { | |||||
// _showPolicy(); | |||||
// } | |||||
// }); | |||||
SharedPreferencesUtil.getStringValue(Constants.isShowPolicy).then((value) { | |||||
Logger.debug(value); | |||||
if (value == null || value == '') { | |||||
_showPolicy(); | |||||
} | |||||
}); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||