🐛 Fix draft box

This commit is contained in:
LittleSheep 2024-10-17 22:44:00 +08:00
parent 56fb92c6b9
commit 0480b5244f
2 changed files with 19 additions and 4 deletions

View File

@ -44,9 +44,12 @@ class PostProvider extends GetxController {
final queries = [ final queries = [
'take=${10}', 'take=${10}',
'offset=$page', 'offset=$page',
'truncate=false',
]; ];
final client = await auth.configureClient('interactive'); final client = await auth.configureClient('interactive');
final resp = await client.get('/posts/drafts?${queries.join('&')}'); final resp = await client.get(
'/posts/drafts?${queries.join('&')}',
);
if (resp.statusCode != 200) { if (resp.statusCode != 200) {
throw RequestException(resp); throw RequestException(resp);
} }

View File

@ -43,7 +43,10 @@ class RootShell extends StatelessWidget {
final showRailNavigation = AppTheme.isLargeScreen(context); final showRailNavigation = AppTheme.isLargeScreen(context);
final destNames = AppNavigation.destinations.map((x) => x.page).toList(); final destNames = [
'postDetail',
...AppNavigation.destinations.map((x) => x.page),
];
final showBottomNavigation = final showBottomNavigation =
destNames.contains(routeName) && !showRailNavigation; destNames.contains(routeName) && !showRailNavigation;
@ -52,13 +55,22 @@ class RootShell extends StatelessWidget {
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.surface,
bottomNavigationBar: showBottomNavigation bottomNavigationBar: showBottomNavigation
? AppNavigationBottom( ? AppNavigationBottom(
initialIndex: destNames.indexOf(routeName ?? 'page'), initialIndex: AppNavigation.destinations
.map((x) => x.page)
.toList()
.indexOf(routeName ?? 'page'),
) )
: null, : null,
body: AppTheme.isLargeScreen(context) body: AppTheme.isLargeScreen(context)
? Row( ? Row(
children: [ children: [
if (showRailNavigation) const AppNavigationRail(), if (showRailNavigation)
AppNavigationRail(
initialIndex: AppNavigation.destinations
.map((x) => x.page)
.toList()
.indexOf(routeName ?? 'page'),
),
if (showRailNavigation) if (showRailNavigation)
const VerticalDivider( const VerticalDivider(
width: 0.3, width: 0.3,