mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-31 12:04:25 -04:00
cleanup
This commit is contained in:
parent
8c89ce91cf
commit
9dfb8c3f71
16 changed files with 305 additions and 162 deletions
|
@ -39,11 +39,11 @@ class _DrawerMenuState extends State<DrawerMenu> {
|
|||
});
|
||||
}
|
||||
|
||||
void _doEditClick(
|
||||
TypedKey superIdentityRecordKey, proto.Profile existingProfile) {
|
||||
void _doEditClick(TypedKey superIdentityRecordKey,
|
||||
proto.Profile existingProfile, OwnedDHTRecordPointer accountRecord) {
|
||||
singleFuture(this, () async {
|
||||
await GoRouterHelper(context).push('/edit_account',
|
||||
extra: [superIdentityRecordKey, existingProfile]);
|
||||
extra: [superIdentityRecordKey, existingProfile, accountRecord]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -128,10 +128,10 @@ class _DrawerMenuState extends State<DrawerMenu> {
|
|||
final superIdentityRecordKey = la.superIdentity.recordKey;
|
||||
|
||||
// See if this account is logged in
|
||||
final avAccountRecordState = perAccountCollectionBlocMapState
|
||||
.get(superIdentityRecordKey)
|
||||
?.avAccountRecordState;
|
||||
if (avAccountRecordState != null) {
|
||||
final perAccountState =
|
||||
perAccountCollectionBlocMapState.get(superIdentityRecordKey);
|
||||
final avAccountRecordState = perAccountState?.avAccountRecordState;
|
||||
if (perAccountState != null && avAccountRecordState != null) {
|
||||
// Account is logged in
|
||||
final scale = theme.extension<ScaleScheme>()!.tertiaryScale;
|
||||
final loggedInAccount = avAccountRecordState.when(
|
||||
|
@ -144,7 +144,11 @@ class _DrawerMenuState extends State<DrawerMenu> {
|
|||
_doSwitchClick(superIdentityRecordKey);
|
||||
},
|
||||
footerCallback: () {
|
||||
_doEditClick(superIdentityRecordKey, value.profile);
|
||||
_doEditClick(
|
||||
superIdentityRecordKey,
|
||||
value.profile,
|
||||
perAccountState.accountInfo.userLogin!.accountRecordInfo
|
||||
.accountRecord);
|
||||
}),
|
||||
loading: () => _wrapInBox(
|
||||
child: buildProgressIndicator(),
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../chat/chat.dart';
|
||||
import '../../../tools/tools.dart';
|
||||
|
||||
class HomeAccountReadyChat extends StatefulWidget {
|
||||
const HomeAccountReadyChat({super.key});
|
||||
|
@ -15,11 +14,6 @@ class HomeAccountReadyChatState extends State<HomeAccountReadyChat> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await changeWindowSetup(
|
||||
TitleBarStyle.normal, OrientationCapability.normal);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -23,11 +23,6 @@ class _HomeAccountReadyMainState extends State<HomeAccountReadyMain> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await changeWindowSetup(
|
||||
TitleBarStyle.normal, OrientationCapability.normal);
|
||||
});
|
||||
}
|
||||
|
||||
Widget buildUserPanel() => Builder(builder: (context) {
|
||||
|
|
|
@ -45,8 +45,20 @@ class HomeScreenState extends State<HomeScreen>
|
|||
curve: Curves.easeInOut,
|
||||
));
|
||||
|
||||
// Account animation setup
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
final localAccounts = context.read<LocalAccountsCubit>().state;
|
||||
final activeLocalAccount = context.read<ActiveLocalAccountCubit>().state;
|
||||
final activeIndex = localAccounts
|
||||
.indexWhere((x) => x.superIdentity.recordKey == activeLocalAccount);
|
||||
final canClose = activeIndex != -1;
|
||||
|
||||
await changeWindowSetup(
|
||||
TitleBarStyle.normal, OrientationCapability.normal);
|
||||
|
||||
if (!canClose) {
|
||||
await _zoomDrawerController.open!();
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -152,6 +164,12 @@ class HomeScreenState extends State<HomeScreen>
|
|||
scale.tertiaryScale.appBackground,
|
||||
]);
|
||||
|
||||
final localAccounts = context.watch<LocalAccountsCubit>().state;
|
||||
final activeLocalAccount = context.watch<ActiveLocalAccountCubit>().state;
|
||||
final activeIndex = localAccounts
|
||||
.indexWhere((x) => x.superIdentity.recordKey == activeLocalAccount);
|
||||
final canClose = activeIndex != -1;
|
||||
|
||||
return SafeArea(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(gradient: gradient),
|
||||
|
@ -178,9 +196,9 @@ class HomeScreenState extends State<HomeScreen>
|
|||
openCurve: Curves.fastEaseInToSlowEaseOut,
|
||||
// duration: const Duration(milliseconds: 250),
|
||||
// reverseDuration: const Duration(milliseconds: 250),
|
||||
menuScreenTapClose: true,
|
||||
mainScreenTapClose: true,
|
||||
//disableDragGesture: false,
|
||||
menuScreenTapClose: canClose,
|
||||
mainScreenTapClose: canClose,
|
||||
disableDragGesture: !canClose,
|
||||
mainScreenScale: .25,
|
||||
slideWidth: min(360, MediaQuery.of(context).size.width * 0.9),
|
||||
)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue