♻️ Refactor the bottom nav display

This commit is contained in:
2025-10-01 16:35:41 +08:00
parent ac2951479b
commit 3bfc0b8181
12 changed files with 47 additions and 103 deletions

View File

@@ -66,7 +66,6 @@ class AccountScreen extends HookConsumerWidget {
isNoBackground: isWide,
appBar: AppBar(backgroundColor: Colors.transparent, toolbarHeight: 0),
body: SingleChildScrollView(
padding: getTabbedPadding(context),
child: Column(
spacing: 4,
children: <Widget>[

View File

@@ -10,7 +10,6 @@ import 'package:island/models/wallet.dart';
import 'package:island/pods/network.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/screens/account/credits.dart';
import 'package:island/services/responsive.dart';
import 'package:island/services/time.dart';
import 'package:island/widgets/account/leveling_progress.dart';
import 'package:island/widgets/account/restore_purchase_sheet.dart';
@@ -259,7 +258,7 @@ class LevelingScreen extends HookConsumerWidget {
),
),
SliverGap(getTabbedPadding(context, vertical: 20).vertical),
SliverGap(20),
],
),
),
@@ -270,7 +269,7 @@ class LevelingScreen extends HookConsumerWidget {
final stellarSubscription = ref.watch(accountStellarSubscriptionProvider);
return SingleChildScrollView(
padding: getTabbedPadding(context, horizontal: 20, vertical: 20),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [

View File

@@ -25,7 +25,6 @@ import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/content/sheet.dart';
import 'package:island/widgets/realm/realm_selection_dropdown.dart';
import 'package:island/widgets/response.dart';
import 'package:island/screens/tabs.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:relative_time/relative_time.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
@@ -219,9 +218,8 @@ class ChatListBodyWidget extends HookConsumerWidget {
ref.invalidate(chatroomsJoinedProvider);
}),
child: ListView.builder(
padding: getTabbedPadding(
context,
bottom: callState.isConnected ? 96 : null,
padding: EdgeInsets.only(
bottom: callState.isConnected ? 96 : 0,
),
itemCount:
items
@@ -531,7 +529,6 @@ class ChatListScreen extends HookConsumerWidget {
},
child: const Icon(Symbols.add),
),
floatingActionButtonLocation: TabbedFabLocation(context),
body: ChatListBodyWidget(
isFloating: false,
tabController: tabController,

View File

@@ -15,7 +15,6 @@ import 'package:island/pods/network.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/screens/realm/realms.dart';
import 'package:island/services/file.dart';
import 'package:island/services/responsive.dart';
import 'package:island/widgets/alert.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/content/cloud_files.dart';
@@ -191,7 +190,7 @@ class EditPublisherScreen extends HookConsumerWidget {
leading: const PageBackButton(),
),
body: SingleChildScrollView(
padding: getTabbedPadding(context, bottom: 16),
padding: EdgeInsets.only(bottom: 16),
child: Column(
children: [
RealmSelectionDropdown(

View File

@@ -13,7 +13,6 @@ import 'package:island/pods/event_calendar.dart';
import 'package:island/pods/userinfo.dart';
import 'package:island/screens/notification.dart';
import 'package:island/services/responsive.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/models/post.dart';
import 'package:island/widgets/check_in.dart';
@@ -21,7 +20,6 @@ import 'package:island/widgets/post/post_featured.dart';
import 'package:island/widgets/post/post_item.dart';
import 'package:island/widgets/post/compose_card.dart';
import 'package:island/widgets/post/compose_dialog.dart';
import 'package:island/screens/tabs.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:riverpod_paging_utils/riverpod_paging_utils.dart';
@@ -231,7 +229,6 @@ class ExploreScreen extends HookConsumerWidget {
child: const Icon(Symbols.edit),
),
),
floatingActionButtonLocation: isWide ? null : TabbedFabLocation(context),
body:
isWide
? _buildWideBody(
@@ -415,7 +412,6 @@ class ExploreScreen extends HookConsumerWidget {
),
),
bodyView,
SliverGap(getTabbedPadding(context).bottom),
],
),
).padding(horizontal: 8),

View File

@@ -12,13 +12,11 @@ import 'package:island/models/realm.dart';
import 'package:island/pods/config.dart';
import 'package:island/pods/network.dart';
import 'package:island/services/file.dart';
import 'package:island/services/responsive.dart';
import 'package:island/widgets/alert.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/content/sheet.dart';
import 'package:island/widgets/response.dart';
import 'package:island/screens/tabs.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';
@@ -90,7 +88,6 @@ class RealmListScreen extends HookConsumerWidget {
});
},
),
floatingActionButtonLocation: TabbedFabLocation(context),
body: ExtendedRefreshIndicator(
child: realms.when(
data:
@@ -100,7 +97,7 @@ class RealmListScreen extends HookConsumerWidget {
child: ListView.separated(
padding: EdgeInsets.only(
top: 8,
bottom: getTabbedPadding(context).bottom + 8,
bottom: MediaQuery.of(context).padding.bottom + 8,
),
itemCount: value.length,
itemBuilder: (context, item) {

View File

@@ -99,57 +99,44 @@ class TabsScreen extends HookConsumerWidget {
);
}
return Container(
color: Theme.of(context).colorScheme.surfaceContainer,
child: Stack(
children: [
Positioned.fill(
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
return Scaffold(
backgroundColor: Colors.transparent,
extendBody: true,
body: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
child: child ?? const SizedBox.shrink(),
),
bottomNavigationBar: ConditionalBottomNav(
child: ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 1, sigmaY: 1),
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface.withOpacity(0.8),
),
child: child ?? const SizedBox.shrink(),
),
),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: ConditionalBottomNav(
child: ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
decoration: BoxDecoration(
color: Theme.of(
context,
).colorScheme.surface.withOpacity(0.8),
),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: NavigationBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
overlayColor: const WidgetStatePropertyAll(
Colors.transparent,
),
surfaceTintColor: Colors.transparent,
height: 56,
labelBehavior:
NavigationDestinationLabelBehavior.alwaysHide,
selectedIndex: currentIndex,
onDestinationSelected: onDestinationSelected,
destinations: destinations,
),
),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: NavigationBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
overlayColor: const WidgetStatePropertyAll(
Colors.transparent,
),
surfaceTintColor: Colors.transparent,
height: 56,
labelBehavior: NavigationDestinationLabelBehavior.alwaysHide,
selectedIndex: currentIndex,
onDestinationSelected: onDestinationSelected,
destinations: destinations,
),
),
),
),
],
),
),
);
}
@@ -178,7 +165,6 @@ class TabbedFabLocation extends FloatingActionButtonLocation {
scaffoldGeometry.floatingActionButtonSize.height -
scaffoldGeometry.bottomSheetSize.height -
safeAreaPadding.bottom -
(isWideScreen(context) ? 32 : 80) +
16;
return Offset(fabX, fabY);