Skip to content

Commit e357331

Browse files
committed
feat: add bottom sheet theme
1 parent 57d1af5 commit e357331

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

example/lib/src/home/home_page.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,30 @@ class _AppBar extends StatelessWidget implements PreferredSizeWidget {
161161
onPressed: () => showSnack(context),
162162
icon: const Icon(Icons.add),
163163
),
164+
IconButton(
165+
onPressed: () => showBottomSheet(
166+
context: context,
167+
builder: (context) => BottomSheet(
168+
enableDrag: false,
169+
onClosing: () {},
170+
builder: (context) => ListView(
171+
padding: const EdgeInsets.all(18.0),
172+
shrinkWrap: true,
173+
children: [
174+
ListTile(
175+
title: const Text('hello'),
176+
onTap: Navigator.of(context).pop,
177+
),
178+
ListTile(
179+
title: const Text('hello'),
180+
onTap: Navigator.of(context).pop,
181+
),
182+
],
183+
),
184+
),
185+
),
186+
icon: const Icon(Icons.vertical_align_top),
187+
),
164188
ValueListenableBuilder(
165189
valueListenable: themeModeNotifier,
166190
builder: (context, themeMode, widget) {

lib/src/theme.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,28 @@ ThemeData _phoenixTheme({
124124
colorScheme: colorScheme,
125125
textStyle: const TextStyle(fontSize: 14, height: 1.08),
126126
),
127+
bottomSheetTheme: _createBottomSheetTheme(colorScheme),
127128
);
128129
}
129130

131+
BottomSheetThemeData _createBottomSheetTheme(ColorScheme colorScheme) =>
132+
BottomSheetThemeData(
133+
elevation: 3,
134+
modalBackgroundColor: _menuBg(colorScheme),
135+
backgroundColor: _menuBg(colorScheme),
136+
shape: RoundedRectangleBorder(
137+
borderRadius: const BorderRadius.only(
138+
topRight: Radius.circular(_kContainerRadius),
139+
topLeft: Radius.circular(_kContainerRadius),
140+
),
141+
side: colorScheme.isLight
142+
? BorderSide.none
143+
: BorderSide(
144+
color: Colors.white.withOpacity(0.05),
145+
),
146+
),
147+
);
148+
130149
ColorScheme _darkScheme(Color color) {
131150
final colorScheme = ColorScheme.fromSeed(
132151
seedColor: color,

0 commit comments

Comments
 (0)