Skip to content

Commit

Permalink
Add volume slider in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
gdelataillade committed Sep 30, 2023
1 parent a38fc92 commit b879173
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions example/lib/screens/edit_alarm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,6 @@ class _ExampleAlarmEditScreenState extends State<ExampleAlarmEditScreen> {
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'System volume max',
style: Theme.of(context).textTheme.titleMedium,
),
Switch(
value: volume != null,
onChanged: (value) => setState(() => volume = value ? 1 : null),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expand Down Expand Up @@ -258,6 +245,45 @@ class _ExampleAlarmEditScreenState extends State<ExampleAlarmEditScreen> {
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Custom volume',
style: Theme.of(context).textTheme.titleMedium,
),
Switch(
value: volume != null,
onChanged: (value) =>
setState(() => volume = value ? 0.5 : null),
),
],
),
SizedBox(
height: 30,
child: volume != null
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
volume! > 0.7
? Icons.volume_up_rounded
: volume! > 0.1
? Icons.volume_down_rounded
: Icons.volume_mute_rounded,
),
Expanded(
child: Slider(
value: volume!,
onChanged: (value) {
setState(() => volume = value);
},
),
),
],
)
: const SizedBox(),
),
if (!creating)
TextButton(
onPressed: deleteAlarm,
Expand Down

0 comments on commit b879173

Please sign in to comment.