Skip to content

Commit

Permalink
When there is no camera, show the search card in fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jul 22, 2023
1 parent 580b822 commit f4e9e17
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions packages/smooth_app/lib/pages/scan/scan_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
import 'package:smooth_app/generic_lib/widgets/smooth_card.dart';
import 'package:smooth_app/helpers/app_helper.dart';
import 'package:smooth_app/helpers/camera_helper.dart';
import 'package:smooth_app/helpers/haptic_feedback_helper.dart';
import 'package:smooth_app/helpers/permission_helper.dart';
import 'package:smooth_app/pages/scan/camera_scan_page.dart';
Expand Down Expand Up @@ -65,6 +66,7 @@ class _ScanPageState extends State<ScanPage> {

final AppLocalizations appLocalizations = AppLocalizations.of(context);
final TextDirection direction = Directionality.of(context);
final bool hasACamera = CameraHelper.hasACamera;

return SmoothScaffold(
brightness:
Expand All @@ -74,26 +76,27 @@ class _ScanPageState extends State<ScanPage> {
body: SafeArea(
child: Column(
children: <Widget>[
Expanded(
flex: 100 - _carouselHeightPct,
child: Consumer<PermissionListener>(
builder: (
BuildContext context,
PermissionListener listener,
_,
) {
switch (listener.value.status) {
case DevicePermissionStatus.checking:
return EMPTY_WIDGET;
case DevicePermissionStatus.granted:
// TODO(m123): change
return const CameraScannerPage();
default:
return const _PermissionDeniedCard();
}
},
if (hasACamera)
Expanded(
flex: 100 - _carouselHeightPct,
child: Consumer<PermissionListener>(
builder: (
BuildContext context,
PermissionListener listener,
_,
) {
switch (listener.value.status) {
case DevicePermissionStatus.checking:
return EMPTY_WIDGET;
case DevicePermissionStatus.granted:
// TODO(m123): change
return const CameraScannerPage();
default:
return const _PermissionDeniedCard();
}
},
),
),
),
Expanded(
flex: _carouselHeightPct,
child: Padding(
Expand Down

0 comments on commit f4e9e17

Please sign in to comment.