Skip to content

Commit

Permalink
[timetable] hide wallpaper icon button
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Sep 23, 2024
1 parent 9796010 commit 7f19bae
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/timetable/p13n/page/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ class _TimetableBackgroundEditorState extends State<TimetableBackgroundEditor> w
onHidden(
child: buildToolBar(),
).padV(4),
CheckboxListTile(
secondary: Icon(hidden ? Icons.hide_image_outlined : Icons.image_outlined),
title: "Show wallpaper".text(),
value: !hidden,
onChanged: (_) {
setState(() {
hidden = !hidden;
});
},
),
if (rawPath != null && (Dev.on || (UniversalPlatform.isDesktop || kIsWeb)))
ListTile(
title: i18n.p13n.background.selectedImage.text(),
Expand Down Expand Up @@ -240,21 +230,32 @@ class _TimetableBackgroundEditorState extends State<TimetableBackgroundEditor> w
}

Widget buildToolBar() {
final hasImage = kIsWeb ? rawPath != null : renderImageFile != null;
return [
FilledButton.icon(
onPressed: chooseImage,
icon: Icon(context.icons.create),
label: i18n.choose.text(),
),
IconButton.outlined(
onPressed: hasImage
? () {
setState(() {
hidden = !hidden;
});
}
: null,
icon: Icon(hidden ? Icons.hide_image_outlined : Icons.image_outlined),
),
OutlinedButton.icon(
onPressed: (kIsWeb ? rawPath == null : renderImageFile == null)
? null
: () {
onPressed: hasImage
? () {
setState(() {
rawPath = null;
renderImageFile = null;
});
},
}
: null,
icon: Icon(context.icons.delete),
label: i18n.delete.text(),
),
Expand Down

0 comments on commit 7f19bae

Please sign in to comment.