move account setting to main settings list screen
parent
9983222f4c
commit
a71c77a04f
|
@ -226,27 +226,6 @@ class CommonTextField extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
// TextField textField({
|
||||
// Color color = kPrimaryColor,
|
||||
// bool obscureText = false,
|
||||
// required String labelText,
|
||||
// required TextEditingController controller,
|
||||
// }) {
|
||||
// return TextField(
|
||||
// controller: controller,
|
||||
// obscureText: obscureText,
|
||||
// cursorColor: kSecondaryColor,
|
||||
// textAlignVertical: TextAlignVertical.bottom,
|
||||
// decoration: InputDecoration(
|
||||
// helperText: '5-10位',
|
||||
// errorText: 'xxx',
|
||||
// labelText: labelText,
|
||||
// floatingLabelStyle: const TextStyle(color: kSecondaryColor),
|
||||
// focusedBorder:
|
||||
// UnderlineInputBorder(borderSide: BorderSide(color: color))),
|
||||
// );
|
||||
// }
|
||||
|
||||
class CommonElevatedButton extends StatelessWidget {
|
||||
const CommonElevatedButton({
|
||||
super.key,
|
||||
|
|
|
@ -28,8 +28,8 @@ class WebSocketManager extends ChangeNotifier {
|
|||
Timer? reconnectTimer;
|
||||
int reconnectCount = 5;
|
||||
int reconnectTimes = 0;
|
||||
Duration heartBeatTimeout = const Duration(seconds: 4);
|
||||
Duration reconnectTimeout = const Duration(seconds: 3);
|
||||
Duration heartBeatTimeout = const Duration(seconds: 30);
|
||||
Duration reconnectTimeout = const Duration(seconds: 5);
|
||||
Map<String, Timer> sendImageTimer = {};
|
||||
|
||||
void connect(String userId, bool isReconnect) {
|
||||
|
@ -39,8 +39,8 @@ class WebSocketManager extends ChangeNotifier {
|
|||
socketStatus = SocketStatus.reconnecting;
|
||||
notifyListeners();
|
||||
}
|
||||
// This doesn't blcok the programe whethe it connect the server or not
|
||||
// So heartBeat will be executre straightly
|
||||
// This doesn't block the program whether it connect the server or not
|
||||
// So heartBeat will be execute straightly
|
||||
channel = WebSocketChannel.connect(wsUrl);
|
||||
heartBeatInspect();
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class _FriendProfileScreenState extends State<FriendProfileScreen> {
|
|||
offset: isOpen ? const Offset(0, 4) : Offset.zero,
|
||||
duration: const Duration(milliseconds: 170),
|
||||
child: AnimatedOpacity(
|
||||
opacity: isOpen ? 0: 1,
|
||||
opacity: isOpen ? 0 : 1,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
child: Text(
|
||||
valueV,
|
||||
|
@ -107,13 +107,20 @@ class _FriendProfileScreenState extends State<FriendProfileScreen> {
|
|||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 200,
|
||||
expandedHeight: 240,
|
||||
floating: true,
|
||||
pinned: true,
|
||||
stretch: true,
|
||||
backgroundColor: Colors.orange,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
centerTitle: true,
|
||||
collapseMode: CollapseMode.pin,
|
||||
centerTitle: true,
|
||||
titlePadding: const EdgeInsets.only(left: 0, bottom: 15),
|
||||
stretchModes: const [
|
||||
StretchMode.zoomBackground,
|
||||
StretchMode.blurBackground,
|
||||
StretchMode.fadeTitle,
|
||||
],
|
||||
title: Text(getIt
|
||||
.get<Contact>()
|
||||
.friends[widget.friendId]!
|
||||
|
@ -170,6 +177,10 @@ class _FriendProfileScreenState extends State<FriendProfileScreen> {
|
|||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
fixedSize: const Size(130, 45),
|
||||
side: const BorderSide(color: kUnAvailableColor),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'语音通话',
|
||||
|
@ -182,6 +193,10 @@ class _FriendProfileScreenState extends State<FriendProfileScreen> {
|
|||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
fixedSize: const Size(100, 45),
|
||||
side: const BorderSide(color: kUnAvailableColor),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'设置',
|
||||
|
|
|
@ -13,10 +13,8 @@ import 'package:together_mobile/common/constants.dart';
|
|||
import 'package:together_mobile/models/contact_model.dart';
|
||||
import 'package:together_mobile/models/route_state_model.dart';
|
||||
import 'package:together_mobile/request/group_chat.dart';
|
||||
import 'package:together_mobile/request/server.dart';
|
||||
import 'package:together_mobile/request/server.dart' show groupChatAvatarsUrl;
|
||||
import 'package:together_mobile/models/init_get_it.dart';
|
||||
import 'package:together_mobile/models/user_model.dart';
|
||||
import 'package:together_mobile/request/user_profile.dart';
|
||||
|
||||
class ChangeGroupChatAvatarScreen extends StatefulWidget {
|
||||
const ChangeGroupChatAvatarScreen({
|
||||
|
@ -69,20 +67,10 @@ class _ChangeGroupChatAvatarScreenState
|
|||
Container(
|
||||
margin: const EdgeInsets.fromLTRB(10, 20, 10, 40),
|
||||
child: _croppedImage == null
|
||||
? getIt
|
||||
.get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.avatar
|
||||
.isEmpty
|
||||
? const CircleAvatar(
|
||||
radius: 100,
|
||||
backgroundImage:
|
||||
AssetImage('assets/images/Logo_light.png'),
|
||||
)
|
||||
: CircleAvatar(
|
||||
? CircleAvatar(
|
||||
radius: 100,
|
||||
backgroundImage: CachedNetworkImageProvider(
|
||||
'$userAvatarsUrl/${getIt.get<ContactAccountProfile>().groupChats[widget.groupChatId]!.avatar}',
|
||||
'$groupChatAvatarsUrl/${getIt.get<ContactAccountProfile>().groupChats[widget.groupChatId]!.avatar}',
|
||||
))
|
||||
: CircleAvatar(
|
||||
radius: 100,
|
||||
|
|
|
@ -7,7 +7,7 @@ class GroupChatProfileTile extends StatelessWidget {
|
|||
super.key,
|
||||
required this.onTap,
|
||||
required this.title,
|
||||
required this.info,
|
||||
this.info = '',
|
||||
});
|
||||
|
||||
final String title;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cherry_toast/cherry_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it_mixin/get_it_mixin.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
|
@ -10,10 +12,12 @@ import 'package:together_mobile/models/init_get_it.dart';
|
|||
import 'package:together_mobile/models/user_model.dart';
|
||||
import 'package:together_mobile/request/group_chat.dart';
|
||||
import 'package:together_mobile/screens/group_chat_profile/components/group_chat_profile_header.dart';
|
||||
import '../../request/server.dart' show groupChatAvatarsUrl;
|
||||
import 'components/group_chat_profile_tile.dart';
|
||||
|
||||
class GroupChatProfileScreen extends StatefulWidget {
|
||||
const GroupChatProfileScreen({
|
||||
class GroupChatProfileScreen extends StatefulWidget
|
||||
with GetItStatefulWidgetMixin {
|
||||
GroupChatProfileScreen({
|
||||
super.key,
|
||||
required this.groupChatId,
|
||||
});
|
||||
|
@ -24,20 +28,21 @@ class GroupChatProfileScreen extends StatefulWidget {
|
|||
State<GroupChatProfileScreen> createState() => _GroupChatProfileScreenState();
|
||||
}
|
||||
|
||||
class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
||||
class _GroupChatProfileScreenState extends State<GroupChatProfileScreen>
|
||||
with GetItStateMixin {
|
||||
Future<bool> _getGroupChatFullProfile() async {
|
||||
Map<String, dynamic> res =
|
||||
await getGroupChatFullProfile(widget.groupChatId);
|
||||
|
||||
getIt.get<ContactAccountProfile>().addGroupChatProfile(
|
||||
widget.groupChatId,
|
||||
res['groupChat'],
|
||||
);
|
||||
get<ContactAccountProfile>().addGroupChatProfile(
|
||||
widget.groupChatId,
|
||||
res['groupChat'],
|
||||
);
|
||||
|
||||
getIt.get<ContactAccountProfile>().refreshGroupChatMemberProfile(
|
||||
widget.groupChatId,
|
||||
res['memberNameAvatar'],
|
||||
);
|
||||
get<ContactAccountProfile>().refreshGroupChatMemberProfile(
|
||||
widget.groupChatId,
|
||||
res['memberNameAvatar'],
|
||||
);
|
||||
|
||||
return Future(() => true);
|
||||
}
|
||||
|
@ -75,30 +80,25 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
SliverToBoxAdapter(
|
||||
child: ListTile(
|
||||
onTap: () {
|
||||
// context.pushNamed(
|
||||
// 'GroupChatOutline',
|
||||
// queryParameters: {'groupChatId': widget.groupChatId},
|
||||
// );
|
||||
context.pushNamed(
|
||||
'ChangeGroupChatAvatar',
|
||||
queryParameters: {'groupChatId': widget.groupChatId},
|
||||
);
|
||||
},
|
||||
leading: const CircleAvatar(
|
||||
backgroundImage: AssetImage('assets/images/Logo_light.png'),
|
||||
leading: CircleAvatar(
|
||||
backgroundImage: CachedNetworkImageProvider(
|
||||
'$groupChatAvatarsUrl/${get<ContactAccountProfile>().groupChats[widget.groupChatId]!.avatar}',
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
getIt
|
||||
.get<Contact>()
|
||||
get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.groupChatRemark
|
||||
.isEmpty
|
||||
? getIt
|
||||
.get<ContactAccountProfile>()
|
||||
? get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.name
|
||||
: getIt
|
||||
.get<Contact>()
|
||||
: get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.groupChatRemark,
|
||||
style: const TextStyle(fontSize: 18),
|
||||
|
@ -117,14 +117,13 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
onTap: () {},
|
||||
title: '群聊成员',
|
||||
info:
|
||||
'共 ${getIt.get<ContactAccountProfile>().groupChats[widget.groupChatId]!.members.length} 人',
|
||||
'共 ${get<ContactAccountProfile>().groupChats[widget.groupChatId]!.members.length} 人',
|
||||
),
|
||||
GroupChatProfileTile(
|
||||
onTap: () {
|
||||
final query = {
|
||||
'groupChatId': widget.groupChatId,
|
||||
'name': getIt
|
||||
.get<ContactAccountProfile>()
|
||||
'name': get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.name,
|
||||
};
|
||||
|
@ -134,8 +133,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
);
|
||||
},
|
||||
title: '群聊名称',
|
||||
info: getIt
|
||||
.get<ContactAccountProfile>()
|
||||
info: get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.name,
|
||||
),
|
||||
|
@ -143,8 +141,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
onTap: () {
|
||||
final query = {
|
||||
'groupChatId': widget.groupChatId,
|
||||
'intro': getIt
|
||||
.get<ContactAccountProfile>()
|
||||
'intro': get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.introduction,
|
||||
};
|
||||
|
@ -154,16 +151,14 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
);
|
||||
},
|
||||
title: '群聊简介',
|
||||
info: getIt
|
||||
.get<ContactAccountProfile>()
|
||||
info: get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.introduction,
|
||||
),
|
||||
GroupChatProfileTile(
|
||||
onTap: () {},
|
||||
title: '群聊标签',
|
||||
info: getIt
|
||||
.get<ContactAccountProfile>()
|
||||
info: get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.tags
|
||||
.join('|'),
|
||||
|
@ -215,8 +210,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
onTap: () {
|
||||
final query = {
|
||||
'groupChatId': widget.groupChatId,
|
||||
'remarkInGroupChat': getIt
|
||||
.get<Contact>()
|
||||
'remarkInGroupChat': get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.remarkInGroupChat,
|
||||
};
|
||||
|
@ -226,8 +220,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
);
|
||||
},
|
||||
title: '我的群聊昵称',
|
||||
info: getIt
|
||||
.get<Contact>()
|
||||
info: get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.remarkInGroupChat,
|
||||
),
|
||||
|
@ -235,8 +228,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
onTap: () {
|
||||
final query = {
|
||||
'groupChatId': widget.groupChatId,
|
||||
'groupChatRemark': getIt
|
||||
.get<Contact>()
|
||||
'groupChatRemark': get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.groupChatRemark,
|
||||
};
|
||||
|
@ -246,8 +238,7 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
);
|
||||
},
|
||||
title: '我的群聊备注',
|
||||
info: getIt
|
||||
.get<Contact>()
|
||||
info: get<Contact>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.groupChatRemark,
|
||||
),
|
||||
|
@ -264,9 +255,8 @@ class _GroupChatProfileScreenState extends State<GroupChatProfileScreen> {
|
|||
title: '删除聊天记录',
|
||||
info: '',
|
||||
),
|
||||
getIt.get<UserAccount>().id ==
|
||||
getIt
|
||||
.get<ContactAccountProfile>()
|
||||
get<UserAccount>().id ==
|
||||
get<ContactAccountProfile>()
|
||||
.groupChats[widget.groupChatId]!
|
||||
.supervisor
|
||||
? SliverToBoxAdapter(
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:together_mobile/common/constants.dart';
|
||||
import 'package:together_mobile/database/hive_database.dart';
|
||||
|
||||
import 'package:together_mobile/models/apply_list_model.dart';
|
||||
|
@ -13,6 +13,9 @@ import 'package:together_mobile/models/token_model.dart';
|
|||
import 'package:together_mobile/models/user_model.dart';
|
||||
import 'package:together_mobile/models/websocket_model.dart';
|
||||
|
||||
import '../../group_chat_profile/components/group_chat_profile_header.dart';
|
||||
import '../../group_chat_profile/components/group_chat_profile_tile.dart';
|
||||
|
||||
class SettingScreen extends StatelessWidget {
|
||||
const SettingScreen({super.key});
|
||||
|
||||
|
@ -29,8 +32,19 @@ class SettingScreen extends StatelessWidget {
|
|||
title: const Text('设置'),
|
||||
),
|
||||
body: CustomScrollView(
|
||||
physics: const BouncingScrollPhysics(
|
||||
parent: AlwaysScrollableScrollPhysics(),
|
||||
),
|
||||
slivers: [
|
||||
// SliverList(delegate: delegate),
|
||||
const GroupChatProfileHeader(
|
||||
header: '账号安全',
|
||||
),
|
||||
GroupChatProfileTile(
|
||||
onTap: () {
|
||||
context.pushNamed('ChangeAccount');
|
||||
},
|
||||
title: '账号设置',
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: TextButton(
|
||||
onPressed: () async {
|
||||
|
@ -52,7 +66,13 @@ class SettingScreen extends StatelessWidget {
|
|||
},
|
||||
);
|
||||
},
|
||||
child: const Text('退出登陆'),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: kErrorColor,
|
||||
),
|
||||
child: const Text(
|
||||
'退出登录',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -63,7 +63,7 @@ class _ChangeAccountScreenState extends State<ChangeAccountScreen> {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: const Text('更改账号资料'),
|
||||
title: const Text('账号设置'),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: ExpansionPanelList(
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:cherry_toast/cherry_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pickers/pickers.dart';
|
||||
import 'package:flutter_pickers/time_picker/model/pduration.dart';
|
||||
|
@ -8,6 +10,8 @@ import 'package:together_mobile/models/init_get_it.dart';
|
|||
import 'package:together_mobile/models/user_model.dart';
|
||||
import 'package:together_mobile/request/user_profile.dart';
|
||||
|
||||
import '../../../request/server.dart' show userAvatarsUrl;
|
||||
|
||||
class ChangeBasicScreen extends StatefulWidget {
|
||||
const ChangeBasicScreen({super.key});
|
||||
|
||||
|
@ -58,7 +62,6 @@ class _ChangeBasicScreenState extends State<ChangeBasicScreen> {
|
|||
Widget build(BuildContext context) {
|
||||
final keys = userProfile.keys.toList();
|
||||
keys.insert(0, '头像');
|
||||
keys.insert(0, '账号');
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
@ -72,14 +75,10 @@ class _ChangeBasicScreenState extends State<ChangeBasicScreen> {
|
|||
itemCount: keys.length,
|
||||
itemBuilder: (context, index) {
|
||||
String key = keys[index];
|
||||
if (key == '账号' || key == '头像') {
|
||||
if (key == '头像') {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (key == '账号') {
|
||||
context.pushNamed('ChangeAccount');
|
||||
} else {
|
||||
context.pushNamed('ChangeMyAvatar');
|
||||
}
|
||||
context.pushNamed('ChangeMyAvatar');
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
|
@ -90,10 +89,19 @@ class _ChangeBasicScreenState extends State<ChangeBasicScreen> {
|
|||
'$key设置',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right_outlined,
|
||||
size: 30,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
height: 65,
|
||||
imageUrl:
|
||||
'$userAvatarsUrl/${getIt.get<UserProfile>().avatar}',
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right_outlined,
|
||||
size: 30,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -57,7 +57,7 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
|
|||
offset: isOpen ? const Offset(0, 4) : Offset.zero,
|
||||
duration: const Duration(milliseconds: 170),
|
||||
child: AnimatedOpacity(
|
||||
opacity: isOpen ? 0: 1,
|
||||
opacity: isOpen ? 0 : 1,
|
||||
duration: const Duration(milliseconds: 120),
|
||||
child: Text(
|
||||
valueV,
|
||||
|
@ -103,14 +103,21 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
|
|||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
expandedHeight: 200,
|
||||
expandedHeight: 240,
|
||||
floating: true,
|
||||
pinned: true,
|
||||
stretch: true,
|
||||
backgroundColor: Colors.orange,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
title: Text(getIt.get<UserProfile>().nickname),
|
||||
titlePadding: const EdgeInsets.only(left: 0, bottom: 15),
|
||||
centerTitle: true,
|
||||
collapseMode: CollapseMode.pin,
|
||||
title: Text(getIt.get<UserProfile>().nickname),
|
||||
stretchModes: const [
|
||||
StretchMode.zoomBackground,
|
||||
StretchMode.blurBackground,
|
||||
StretchMode.fadeTitle,
|
||||
],
|
||||
background: Center(
|
||||
child: Material(
|
||||
elevation: 10.0,
|
||||
|
@ -156,6 +163,10 @@ class _MyProfileScreenState extends State<MyProfileScreen> {
|
|||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
fixedSize: const Size(150, 45),
|
||||
side: const BorderSide(color: kUnAvailableColor),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'编辑资料',
|
||||
|
|
Loading…
Reference in New Issue