✨ Splash screen loading
This commit is contained in:
@ -65,7 +65,7 @@ class ChatMessage extends StatelessWidget {
|
||||
key: Key('chat-message-${data.id}'),
|
||||
iconOnLeftSwipe: Symbols.reply,
|
||||
iconOnRightSwipe: Symbols.edit,
|
||||
swipeSensitivity: 20,
|
||||
swipeSensitivity: 10,
|
||||
onLeftSwipe: onReply != null ? (_) => onReply!(data) : null,
|
||||
onRightSwipe: (onEdit != null && isOwner) ? (_) => onEdit!(data) : null,
|
||||
child: ContextMenuArea(
|
||||
|
@ -176,7 +176,7 @@ class MarkdownTextContent extends StatelessWidget {
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
child: AspectRatio(
|
||||
aspectRatio: attachment.metadata['ratio'] ??
|
||||
aspectRatio: attachment.metadata['ratio']?.toDouble() ??
|
||||
switch (attachment.mimetype
|
||||
.split('/')
|
||||
.firstOrNull) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@ -11,9 +12,11 @@ import 'package:provider/provider.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:surface/providers/config.dart';
|
||||
import 'package:surface/providers/navigation.dart';
|
||||
import 'package:surface/providers/sn_network.dart';
|
||||
import 'package:surface/providers/sn_realm.dart';
|
||||
import 'package:surface/providers/userinfo.dart';
|
||||
import 'package:surface/widgets/account/account_image.dart';
|
||||
import 'package:surface/widgets/universal_image.dart';
|
||||
import 'package:surface/widgets/version_label.dart';
|
||||
|
||||
class AppNavigationDrawer extends StatefulWidget {
|
||||
@ -39,6 +42,7 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ua = context.read<UserProvider>();
|
||||
final sn = context.read<SnNetworkProvider>();
|
||||
final nav = context.watch<NavigationProvider>();
|
||||
final cfg = context.watch<ConfigProvider>();
|
||||
final rel = context.read<SnRealmProvider>();
|
||||
@ -72,42 +76,111 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
||||
child: WindowTitleBarBox(),
|
||||
),
|
||||
Gap(MediaQuery.of(context).padding.top),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Solar Network').bold(),
|
||||
AppVersionLabel(),
|
||||
],
|
||||
).padding(
|
||||
horizontal: 32,
|
||||
vertical: 12,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
...rel.availableRealms.map((ele) {
|
||||
return ListTile(
|
||||
minTileHeight: 48,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 24),
|
||||
leading: AccountImage(
|
||||
content: ele.avatar,
|
||||
radius: 16,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (Widget child,
|
||||
Animation<double> primaryAnimation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return SharedAxisTransition(
|
||||
animation: primaryAnimation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
fillColor: Colors.transparent,
|
||||
transitionType: SharedAxisTransitionType.horizontal,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: nav.focusedRealm == null
|
||||
? ListView(
|
||||
key: const Key('realm-list-view'),
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Solar Network').bold(),
|
||||
AppVersionLabel(),
|
||||
],
|
||||
).padding(
|
||||
horizontal: 32,
|
||||
vertical: 12,
|
||||
),
|
||||
...rel.availableRealms.map((ele) {
|
||||
return ListTile(
|
||||
minTileHeight: 48,
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(horizontal: 24),
|
||||
leading: AccountImage(
|
||||
content: ele.avatar,
|
||||
radius: 16,
|
||||
),
|
||||
title: Text(ele.name),
|
||||
onTap: () {
|
||||
if (Scaffold.of(context).isDrawerOpen) {
|
||||
GoRouter.of(context).goNamed(
|
||||
'realmDetail',
|
||||
pathParameters: {
|
||||
'alias': ele.alias,
|
||||
},
|
||||
);
|
||||
Scaffold.of(context).closeDrawer();
|
||||
}
|
||||
nav.setFocusedRealm(ele);
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
)
|
||||
: ListView(
|
||||
key: ValueKey(nav.focusedRealm),
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
if (nav.focusedRealm!.banner != null)
|
||||
AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: AutoResizeUniversalImage(
|
||||
sn.getAttachmentUrl(
|
||||
nav.focusedRealm!.banner!,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
minTileHeight: 48,
|
||||
tileColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.surfaceContainer,
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 16,
|
||||
),
|
||||
leading: AccountImage(
|
||||
content: nav.focusedRealm!.avatar,
|
||||
radius: 16,
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Symbols.close),
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
visualDensity: VisualDensity.compact,
|
||||
onPressed: () {
|
||||
nav.setFocusedRealm(null);
|
||||
},
|
||||
),
|
||||
title: Text(nav.focusedRealm!.name),
|
||||
onTap: () {
|
||||
GoRouter.of(context).pushNamed(
|
||||
'realmDetail',
|
||||
pathParameters: {
|
||||
'alias': nav.focusedRealm!.alias,
|
||||
},
|
||||
);
|
||||
Scaffold.of(context).closeDrawer();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
title: Text(ele.name),
|
||||
onTap: () {
|
||||
GoRouter.of(context).goNamed(
|
||||
'realmDetail',
|
||||
pathParameters: {
|
||||
'alias': ele.alias,
|
||||
},
|
||||
);
|
||||
Scaffold.of(context).closeDrawer();
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
@ -115,13 +188,17 @@ class _AppNavigationDrawerState extends State<AppNavigationDrawer> {
|
||||
children: nav.destinations.where((ele) => ele.isPinned).map(
|
||||
(ele) {
|
||||
return Expanded(
|
||||
child: IconButton.filledTonal(
|
||||
icon: ele.icon,
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
onPressed: () {
|
||||
GoRouter.of(context).goNamed(ele.screen);
|
||||
Scaffold.of(context).closeDrawer();
|
||||
},
|
||||
child: Tooltip(
|
||||
message: ele.label.tr(),
|
||||
child: IconButton.filledTonal(
|
||||
icon: ele.icon,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
onPressed: () {
|
||||
GoRouter.of(context).goNamed(ele.screen);
|
||||
Scaffold.of(context).closeDrawer();
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
Reference in New Issue
Block a user