diff --git a/app/lib/widget/setup.dart b/app/lib/widget/setup.dart index b8f5e0a1..6cc8c52d 100644 --- a/app/lib/widget/setup.dart +++ b/app/lib/widget/setup.dart @@ -43,6 +43,7 @@ class _SetupState extends State { Widget _buildContent(BuildContext context) { final page = _pageController.hasClients ? _pageController.page!.round() : 0; final pages = [ + if (_initialProgress & _PageId.exif == 0) _Exif(), if (_initialProgress & _PageId.hiddenPrefDirNotice == 0) _HiddenPrefDirNotice(), ]; @@ -124,14 +125,73 @@ class _SetupState extends State { } class _PageId { + static const exif = 0x01; static const hiddenPrefDirNotice = 0x02; - static const all = hiddenPrefDirNotice; + static const all = exif | hiddenPrefDirNotice; } abstract class _Page { int getPageId(); } +class _Exif extends StatefulWidget implements _Page { + @override + createState() => _ExifState(); + + @override + getPageId() => _PageId.exif; +} + +class _ExifState extends State<_Exif> { + @override + build(BuildContext context) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SwitchListTile( + title: Text(L10n.global().settingsExifSupportTitle), + value: _isEnableExif, + onChanged: _onValueChanged, + ), + const SizedBox(height: 8), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text(L10n.global().exifSupportDetails), + ), + const SizedBox(height: 16), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + L10n.global().setupSettingsModifyLaterHint, + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(fontStyle: FontStyle.italic), + ), + ), + const SizedBox(height: 8), + ], + ), + ); + } + + @override + dispose() { + super.dispose(); + // persist user's choice + Pref().setEnableExif(_isEnableExif); + } + + void _onValueChanged(bool value) { + setState(() { + _isEnableExif = value; + }); + } + + bool _isEnableExif = Pref().isEnableExifOr(); +} + class _HiddenPrefDirNotice extends StatefulWidget implements _Page { @override createState() => _HiddenPrefDirNoticeState();