Untitled
unknown
dart
2 years ago
6.0 kB
3
Indexable
import 'package:base_architecture/core/constants/theme.dart'; import 'package:base_architecture/core/extensions/widget_extensions.dart'; import 'package:base_architecture/core/shared_widgets/ACScaffold.dart'; import 'package:base_architecture/presentation/notifiers/theme_notifier.dart'; import 'package:base_architecture/presentation/pages/main/main_page.dart'; import 'package:base_architecture/presentation/resources/color_manager.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_uxcam/flutter_uxcam.dart'; import 'package:provider/provider.dart'; class PlayerWithoutButtonsDialog extends StatelessWidget { const PlayerWithoutButtonsDialog({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { Size mediaQuery = MediaQuery.of(context).size; ThemeNotifier themeNotifier = Provider.of<ThemeNotifier>( context, listen: true, ); return Dialog( backgroundColor: Colors.transparent, child: Center( child: Container( margin: const EdgeInsets.only( bottom: 50, ), width: mediaQuery.width * 0.85, decoration: BoxDecoration( color: themeNotifier.getTheme().primaryColor, borderRadius: const BorderRadius.all( Radius.circular(10), ), ), child: Padding( padding: EdgeInsets.symmetric( horizontal: mediaQuery.width * 0.04, vertical: mediaQuery.height * 0.024, ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ _closeDialogButton(themeNotifier, context, mediaQuery), _dialogTitle(themeNotifier, mediaQuery), _dialogBody(themeNotifier, mediaQuery), ], ), ), ), ), ); } Widget _dialogBody(ThemeNotifier themeNotifier, Size mediaQuery) => MergeSemantics( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Tapping anywhere on the screen will activate the App.'.tr(), style: themeNotifier.getTheme().textTheme.headline2!.copyWith( fontSize: 18, color: themeNotifier.getTheme().shadowColor, ), ).padding( padding: EdgeInsets.only(bottom: mediaQuery.height * 0.03), ), SvgPicture.asset( 'assets/svg/icSwipeLeft.svg', color: themeNotifier.getTheme() == AppThemes().darkTheme ? ColorManager.white : HexColor.fromHex('#003260'), ).padding( padding: EdgeInsets.only(bottom: mediaQuery.height * 0.03), ), Text( 'Swipe left 15 seconds back'.tr(), style: themeNotifier.getTheme().textTheme.headline2!.copyWith( fontSize: 17, color: themeNotifier.getTheme().hoverColor, ), ).padding( padding: EdgeInsets.only(bottom: mediaQuery.height * 0.03), ), SvgPicture.asset( 'assets/svg/icSwipeRight.svg', color: themeNotifier.getTheme() == AppThemes().darkTheme ? ColorManager.white : HexColor.fromHex('#003260'), ).padding( padding: EdgeInsets.only(bottom: mediaQuery.height * 0.03), ), Text( 'Swipe right 15 seconds forward'.tr(), style: themeNotifier.getTheme().textTheme.headline2!.copyWith( fontSize: 17, color: themeNotifier.getTheme().hoverColor, ), ).padding( padding: EdgeInsets.only(bottom: mediaQuery.height * 0.03), ), ], ), ); Widget _closeDialogButton( ThemeNotifier themeNotifier, BuildContext context, Size mediaQuery, ) => Align( alignment: Alignment.topRight, child: MergeSemantics( child: Semantics( label: 'Close'.tr(), child: Container( height: 44, width: 44, decoration: BoxDecoration( color: themeNotifier.getTheme().focusColor, border: Border.all( color: themeNotifier.getTheme() == AppThemes().darkTheme ? Colors.transparent : HexColor.fromHex('#E9EBEF'), width: 1.5, ), borderRadius: const BorderRadius.all( Radius.circular(10), ), ), child: IconButton( iconSize: mediaQuery.height * 0.023, icon: Icon( Icons.close, color: themeNotifier.getTheme().hoverColor, ), onPressed: () { Navigator.of(context).pop(); mixpanel?.track('Pressed back '); FlutterUxcam.logEvent('Pressed back '); }, ), ), ), ), ); Widget _dialogTitle( ThemeNotifier themeNotifier, Size mediaQuery, ) => MergeSemantics( child: Text( 'Use without buttons'.tr(), style: themeNotifier.getTheme().textTheme.headline2!.copyWith( color: themeNotifier.getTheme().hoverColor, fontSize: mediaQuery.height * 0.03, fontWeight: FontWeight.bold, ), ).padding( padding: EdgeInsetsDirectional.only( top: mediaQuery.height * 0.035, bottom: mediaQuery.height * 0.01, ), ), ); }
Editor is loading...