Better side navigation

🐛 Bug fixes and optimizations
This commit is contained in:
2024-09-13 20:22:10 +08:00
parent dd01f964d4
commit b449735bf5
33 changed files with 212 additions and 182 deletions

View File

@@ -133,7 +133,7 @@ class _FriendScreenState extends State<FriendScreen>
).paddingAll(14),
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
bottom: TabBar(

View File

@@ -152,7 +152,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
SliverAppBar(
centerTitle: false,
floating: true,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
leadingWidth: 24,
automaticallyImplyLeading: false,
flexibleSpace: Row(
@@ -207,7 +207,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
onPressed: null,
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
),

View File

@@ -205,7 +205,7 @@ class _CallScreenState extends State<CallScreen> with TickerProviderStateMixin {
: AppBar(
leading: AppBarLeadingButton.adaptive(context),
centerTitle: true,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
title: Obx(
() => RichText(
textAlign: TextAlign.center,

View File

@@ -217,8 +217,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle(title),
centerTitle: false,
titleSpacing: SolianTheme.titleSpacing(context),
toolbarHeight: SolianTheme.toolbarHeight(context),
titleSpacing: AppTheme.titleSpacing(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
const BackgroundStateWidget(),
Builder(builder: (context) {
@@ -255,7 +255,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
},
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
),
@@ -276,7 +276,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
channel: _channel!,
ongoingCall: _ongoingCall!,
onJoin: () {
if (!SolianTheme.isLargeScreen(context)) {
if (!AppTheme.isLargeScreen(context)) {
final ChatCallProvider call = Get.find();
call.gotoScreen(context);
}
@@ -337,7 +337,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
Obx(() {
final ChatCallProvider call = Get.find();
if (call.isMounted.value && SolianTheme.isLargeScreen(context)) {
if (call.isMounted.value && AppTheme.isLargeScreen(context)) {
return const Expanded(
child: Row(children: [
VerticalDivider(width: 0.3, thickness: 0.3),

View File

@@ -110,7 +110,7 @@ class _ChannelOrganizeScreenState extends State<ChannelOrganizeScreen> {
appBar: AppBar(
title: AppBarTitle('channelOrganizing'.tr),
centerTitle: false,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
TextButton(
onPressed: _isBusy ? null : () => applyChannel(),

View File

@@ -47,7 +47,7 @@ class _ChatScreenState extends State<ChatScreen> {
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle('chat'.tr),
centerTitle: true,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
const BackgroundStateWidget(),
const NotificationButton(),
@@ -95,7 +95,7 @@ class _ChatScreenState extends State<ChatScreen> {
],
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
),

View File

@@ -504,7 +504,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
/// Footer
Column(
mainAxisAlignment: SolianTheme.isLargeScreen(context)
mainAxisAlignment: AppTheme.isLargeScreen(context)
? MainAxisAlignment.start
: MainAxisAlignment.center,
children: [

View File

@@ -85,13 +85,13 @@ class _FeedScreenState extends State<FeedScreen>
title: AppBarTitle('feed'.tr),
centerTitle: false,
floating: true,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
leading: AppBarLeadingButton.adaptive(context),
actions: [
const BackgroundStateWidget(),
const NotificationButton(),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
bottom: TabBar(
@@ -118,7 +118,9 @@ class _FeedScreenState extends State<FeedScreen>
MaterialBanner(
leading: const Icon(Icons.layers),
content: Text(
'Browsing in realm #${navState.focusedRealm.value!.alias}',
'postBrowsingIn'.trParams({
'region': '#${navState.focusedRealm.value!.alias}',
}),
),
actions: const [SizedBox.shrink()],
),

View File

@@ -61,10 +61,10 @@ class _DraftBoxScreenState extends State<DraftBoxScreen> {
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle('draftBox'.tr),
centerTitle: false,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
),

View File

@@ -11,6 +11,7 @@ import 'package:solian/models/post.dart';
import 'package:solian/models/realm.dart';
import 'package:solian/providers/attachment_uploader.dart';
import 'package:solian/providers/auth.dart';
import 'package:solian/providers/navigation.dart';
import 'package:solian/router.dart';
import 'package:solian/theme.dart';
import 'package:solian/widgets/app_bar_leading.dart';
@@ -124,7 +125,12 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
void initState() {
super.initState();
if (widget.edit == null && widget.reply == null && widget.repost == null) {
_editorController.localRead();
_editorController.localRead().then((res) {
if (!res) {
final navState = Get.find<NavigationStateProvider>();
_editorController.realmZone.value = navState.focusedRealm.value;
}
});
}
if (widget.reply != null) {
_editorController.replyTo.value = widget.reply;
@@ -158,7 +164,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
),
),
centerTitle: false,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
TextButton(
onPressed: _isBusy ? null : () => _applyPost(),
@@ -177,23 +183,19 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
children: [
ListTile(
tileColor: Theme.of(context).colorScheme.surfaceContainerLow,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
Text(
_editorController.title ?? 'title'.tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
title: Row(
children: [
Text(
_editorController.title ?? 'title'.tr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const Gap(6),
if (_editorController.aliasController.text.isNotEmpty)
Badge(
label: Text('#${_editorController.aliasController.text}'),
),
const Gap(6),
if (_editorController.aliasController.text.isNotEmpty)
Badge(
label:
Text('#${_editorController.aliasController.text}'),
),
],
),
],
),
subtitle: Text(
_editorController.description ?? 'description'.tr,
@@ -365,12 +367,12 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
],
),
),
if (SolianTheme.isLargeScreen(context))
if (AppTheme.isLargeScreen(context))
const VerticalDivider(width: 0.3, thickness: 0.3)
.paddingSymmetric(
horizontal: 16,
),
if (SolianTheme.isLargeScreen(context))
if (AppTheme.isLargeScreen(context))
Expanded(
child: SingleChildScrollView(
child: MarkdownTextContent(

View File

@@ -62,7 +62,7 @@ class _RealmListScreenState extends State<RealmListScreen> {
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle('realm'.tr),
centerTitle: true,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
const BackgroundStateWidget(),
const NotificationButton(),
@@ -77,7 +77,7 @@ class _RealmListScreenState extends State<RealmListScreen> {
},
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
),

View File

@@ -102,7 +102,7 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
leading: AppBarLeadingButton.adaptive(context),
title: AppBarTitle('realmOrganizing'.tr),
centerTitle: false,
toolbarHeight: SolianTheme.toolbarHeight(context),
toolbarHeight: AppTheme.toolbarHeight(context),
actions: [
TextButton(
onPressed: _isBusy ? null : () => applyRealm(),

View File

@@ -114,7 +114,7 @@ class _RealmViewScreenState extends State<RealmViewScreen> {
},
),
SizedBox(
width: SolianTheme.isLargeScreen(context) ? 8 : 16,
width: AppTheme.isLargeScreen(context) ? 8 : 16,
),
],
bottom: const TabBar(

View File

@@ -33,11 +33,11 @@ class _SettingScreenState extends State<SettingScreen> {
tooltip: label,
onPressed: () {
context.read<ThemeSwitcher>().setTheme(
SolianTheme.build(
AppTheme.build(
Brightness.light,
seedColor: color,
),
SolianTheme.build(
AppTheme.build(
Brightness.dark,
seedColor: color,
),