m3_lightmeter/lib/screens/permissions_check/screen_permissions_check.dart
Vadim 00c0a6134d Implemented metering dialog picker
typo

fixed closed container scale

fixed dialog title animation

implemented `AnimatedDialog`

added open/close children transition

clean up

close dialog
2022-12-04 16:22:39 +03:00

64 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'bloc_permissions_check.dart';
import 'state_permissions_check.dart';
class PermissionsCheckScreen extends StatelessWidget {
const PermissionsCheckScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(Dimens.paddingM * 2),
child: Center(
child: BlocConsumer<PermissionsCheckBloc, PermissionsCheckState>(
listener: (context, state) {
if (state is PermissionsGrantedState) {
Navigator.of(context).pushReplacementNamed("metering");
}
},
builder: (context, state) {
return AnimatedSwitcher(
duration: Dimens.durationS,
child: state is LoadingState
? const CircularProgressIndicator()
: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
S.of(context).permissionNeeded,
style: Theme.of(context).textTheme.headlineLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: Dimens.grid16),
Text(
S.of(context).permissionNeededMessage,
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: Dimens.grid24),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
),
onPressed: () {},
child: Text(S.of(context).openSettings),
),
],
),
);
},
),
),
),
),
);
}
}