Skip to content

Commit

Permalink
feat: add bottom sheet theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Nov 18, 2024
1 parent 57d1af5 commit e357331
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions example/lib/src/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,30 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget {
onPressed: () => showSnack(context),
icon: const Icon(Icons.add),
),
IconButton(
onPressed: () => showBottomSheet(
context: context,
builder: (context) => BottomSheet(
enableDrag: false,
onClosing: () {},
builder: (context) => ListView(
padding: const EdgeInsets.all(18.0),
shrinkWrap: true,
children: [
ListTile(
title: const Text('hello'),
onTap: Navigator.of(context).pop,
),
ListTile(
title: const Text('hello'),
onTap: Navigator.of(context).pop,
),
],
),
),
),
icon: const Icon(Icons.vertical_align_top),
),
ValueListenableBuilder(
valueListenable: themeModeNotifier,
builder: (context, themeMode, widget) {
Expand Down
19 changes: 19 additions & 0 deletions lib/src/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,28 @@ ThemeData _phoenixTheme({
colorScheme: colorScheme,
textStyle: const TextStyle(fontSize: 14, height: 1.08),
),
bottomSheetTheme: _createBottomSheetTheme(colorScheme),
);
}

BottomSheetThemeData _createBottomSheetTheme(ColorScheme colorScheme) =>
BottomSheetThemeData(
elevation: 3,
modalBackgroundColor: _menuBg(colorScheme),
backgroundColor: _menuBg(colorScheme),
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.only(
topRight: Radius.circular(_kContainerRadius),
topLeft: Radius.circular(_kContainerRadius),
),
side: colorScheme.isLight
? BorderSide.none
: BorderSide(
color: Colors.white.withOpacity(0.05),
),
),
);

ColorScheme _darkScheme(Color color) {
final colorScheme = ColorScheme.fromSeed(
seedColor: color,
Expand Down

0 comments on commit e357331

Please sign in to comment.