diff --git a/lib/tools/login/login_page.dart b/lib/tools/login/login_page.dart index f57b479..584b903 100644 --- a/lib/tools/login/login_page.dart +++ b/lib/tools/login/login_page.dart @@ -1,9 +1,12 @@ import 'dart:async'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:talk/tools/login/login_model.dart'; +import '../me/agreement_page.dart'; + class LoginPage extends StatefulWidget { const LoginPage({super.key}); @@ -160,9 +163,35 @@ class _LoginPageState extends State { child: RichText( text: TextSpan(children: [ TextSpan(text: '我已阅读并同意', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), - TextSpan(text: '用户协议', style: TextStyle(fontSize: 12, color: Color(0xFFFF9000))), + TextSpan( + text: '用户协议', + style: TextStyle(fontSize: 12, color: Color(0xFFFF9000)), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AgreementPage( + title: "用户协议", + url: "https://shhuanmeng.com/yonghuxieyi.html", + )), + ); + }), TextSpan(text: '和', style: TextStyle(fontSize: 12, color: Color(0xFF5F5F5F))), - TextSpan(text: '隐私协议', style: TextStyle(fontSize: 12, color: Color(0xFFFF9000))), + TextSpan( + text: '隐私协议', + style: TextStyle(fontSize: 12, color: Color(0xFFFF9000)), + recognizer: TapGestureRecognizer() + ..onTap = () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AgreementPage( + title: "隐私协议", + url: "https://shhuanmeng.com/yinsixieyi.html", + )), + ); + }), ]), ), ) diff --git a/lib/tools/me/setting_page.dart b/lib/tools/me/setting_page.dart index fe27f65..18c65ae 100644 --- a/lib/tools/me/setting_page.dart +++ b/lib/tools/me/setting_page.dart @@ -1,5 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:talk/network/NetworkConfig.dart'; +import '../home_page.dart'; import 'agreement_page.dart'; class SettingPage extends StatefulWidget { @@ -127,18 +130,30 @@ class _SettingApgeState extends State { ), ), ), - Container( - width: 221, - height: 37, - alignment: Alignment.center, - margin: EdgeInsets.only(top: 40), - decoration: BoxDecoration( - color: Color(0xFFFF9000), - borderRadius: BorderRadius.all(Radius.circular(7.0)), - ), - child: Text( - '退出登录', - style: TextStyle(fontSize: 13, color: Colors.black), + GestureDetector( + onTap: () async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + await prefs.setString('token', ""); + NetworkConfig.userId = ""; + + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute(builder: (context) => const HomePage()), + (Route route) => false, + ); + }, + child: Container( + width: 221, + height: 37, + alignment: Alignment.center, + margin: EdgeInsets.only(top: 40), + decoration: BoxDecoration( + color: Color(0xFFFF9000), + borderRadius: BorderRadius.all(Radius.circular(7.0)), + ), + child: Text( + '退出登录', + style: TextStyle(fontSize: 13, color: Colors.black), + ), ), ) ], diff --git a/lib/tools/message/message_page.dart b/lib/tools/message/message_page.dart index 4cafc33..dd870cb 100644 --- a/lib/tools/message/message_page.dart +++ b/lib/tools/message/message_page.dart @@ -208,7 +208,6 @@ class _MessagePageState extends State { } doNothing(BuildContext context, id, index) { - print("object"); delIndex = index; EasyLoading.show(status: 'loading...'); _viewmodel.delChat(id);