Skip to content

Commit

Permalink
[scanner] center the footer actions
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Sep 24, 2024
1 parent ef08bb0 commit d29976c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions lib/intent/qrcode/page/scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart' as p;
Expand Down Expand Up @@ -146,6 +145,7 @@ class _ScannerPageState extends State<ScannerPage> with WidgetsBindingObserver {
buildSwitchButton(),
if (UniversalPlatform.isAndroid || UniversalPlatform.isIOS) buildScanImageButton(),
],
persistentFooterAlignment: AlignmentDirectional.center,
);
}

Expand All @@ -157,14 +157,14 @@ class _ScannerPageState extends State<ScannerPage> with WidgetsBindingObserver {
}

Widget buildScanImageButton() {
return PlatformIconButton(
return IconButton.filledTonal(
icon: const Icon(Icons.image),
onPressed: recognizeFromFile,
);
}

Widget buildSwitchButton() {
return PlatformIconButton(
return IconButton.filledTonal(
icon: Icon(context.icons.switchCamera),
onPressed: () => controller.switchCamera(),
);
Expand All @@ -173,18 +173,19 @@ class _ScannerPageState extends State<ScannerPage> with WidgetsBindingObserver {
Widget buildTorchButton() {
return controller >>
(context, state) => switch (state.torchState) {
TorchState.off => PlatformIconButton(
TorchState.off => IconButton.filledTonal(
icon: const Icon(Icons.flash_off),
onPressed: controller.toggleTorch,
),
TorchState.on => PlatformIconButton(
TorchState.on => IconButton.filledTonal(
icon: const Icon(Icons.flash_on, color: Colors.yellow),
onPressed: controller.toggleTorch,
),
TorchState.unavailable => PlatformIconButton(
icon: const Icon(Icons.flash_off),
TorchState.unavailable => const IconButton.filledTonal(
icon: Icon(Icons.flash_off),
onPressed: null,
),
TorchState.auto => PlatformIconButton(
TorchState.auto => IconButton.filledTonal(
icon: const Icon(Icons.flash_on),
onPressed: controller.toggleTorch,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/timetable/p13n/page/palette.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _TimetableP13nPageState extends ConsumerState<TimetablePaletteListPage> wi
FilledButton.tonalIcon(
onPressed: generateFromImage,
icon: const Icon(Icons.generating_tokens_outlined),
label:i18n.p13n.palette.generate.text(),
label: i18n.p13n.palette.generate.text(),
),
FilledButton.icon(
onPressed: addPalette,
Expand Down

0 comments on commit d29976c

Please sign in to comment.