-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
370 additions
and
11 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import 'package:fluffychat/pages/error_page/error_page_style.dart'; | ||
import 'package:fluffychat/resource/image_paths.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/flutter_svg.dart'; | ||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
class ErrorPage extends StatelessWidget { | ||
const ErrorPage({Key? key}) : super(key: key); | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
// Add invisible appbar to make status bar on Android tablets bright. | ||
appBar: AppBar( | ||
automaticallyImplyLeading: false, | ||
elevation: 0, | ||
backgroundColor: Theme.of(context).scaffoldBackgroundColor, | ||
), | ||
extendBodyBehindAppBar: true, | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
ErrorPageStyle.responsiveUtils.isMobile(context) | ||
? const _ErrorPageBackgroundMobile() | ||
: const _ErrorPageBackgroundWeb(), | ||
const _ErrorPageText(), | ||
const _ErrorPageBackButton(), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class _ErrorPageBackgroundWeb extends StatelessWidget { | ||
const _ErrorPageBackgroundWeb(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Stack( | ||
alignment: Alignment.bottomCenter, | ||
children: [ | ||
SvgPicture.asset( | ||
ImagePaths.icErrorPageBackground, | ||
colorFilter: ErrorPageStyle.backgroundColorFilter(context), | ||
fit: BoxFit.contain, | ||
), | ||
SvgPicture.asset( | ||
ImagePaths.icErrorPage, | ||
width: ErrorPageStyle.backgroundIconWidthWeb, | ||
fit: BoxFit.contain, | ||
), | ||
], | ||
); | ||
} | ||
} | ||
|
||
class _ErrorPageBackgroundMobile extends StatelessWidget { | ||
const _ErrorPageBackgroundMobile(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SvgPicture.asset( | ||
ImagePaths.icErrorPage, | ||
width: ErrorPageStyle.backgroundIconWidthMobile, | ||
fit: BoxFit.contain, | ||
); | ||
} | ||
} | ||
|
||
class _ErrorPageBackButton extends StatelessWidget { | ||
const _ErrorPageBackButton(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return TextButton.icon( | ||
icon: const Icon(Icons.arrow_back), | ||
onPressed: () => _goToRooms, | ||
label: Text( | ||
L10n.of(context)!.errorPageButton, | ||
), | ||
style: ErrorPageStyle.buttonStyle(context), | ||
); | ||
} | ||
|
||
void _goToRooms(BuildContext context) { | ||
context.go('/rooms'); | ||
} | ||
} | ||
|
||
class _ErrorPageText extends StatelessWidget { | ||
const _ErrorPageText(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: ErrorPageStyle.textPadding, | ||
child: Column( | ||
children: [ | ||
Text( | ||
L10n.of(context)!.errorPageTitle, | ||
style: ErrorPageStyle.titleTextStyle(context), | ||
), | ||
const SizedBox(height: ErrorPageStyle.textsGap), | ||
Text( | ||
L10n.of(context)!.errorPageDescription, | ||
style: ErrorPageStyle.descriptionTextStyle(context), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'package:fluffychat/di/global/get_it_initializer.dart'; | ||
import 'package:fluffychat/utils/responsive/responsive_utils.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:linagora_design_flutter/linagora_design_flutter.dart'; | ||
|
||
class ErrorPageStyle { | ||
static final ResponsiveUtils responsiveUtils = getIt.get<ResponsiveUtils>(); | ||
|
||
static ColorFilter backgroundColorFilter(BuildContext context) => | ||
ColorFilter.mode( | ||
Theme.of(context).colorScheme.primaryContainer, | ||
BlendMode.srcATop, | ||
); | ||
|
||
static const double backgroundIconWidthWeb = 448.0; | ||
static const double backgroundIconWidthMobile = 280.0; | ||
|
||
static const EdgeInsets textPadding = EdgeInsets.symmetric(vertical: 32.0); | ||
|
||
static TextStyle? titleTextStyle(BuildContext context) => | ||
ErrorPageStyle.responsiveUtils.isMobile(context) | ||
? Theme.of(context).textTheme.headlineSmall?.copyWith( | ||
fontWeight: FontWeight.w600, | ||
color: Theme.of(context).colorScheme.onSurface, | ||
) | ||
: Theme.of(context).textTheme.headlineLarge?.copyWith( | ||
fontWeight: FontWeight.w600, | ||
color: Theme.of(context).colorScheme.onSurface, | ||
); | ||
static TextStyle? descriptionTextStyle(BuildContext context) => | ||
ErrorPageStyle.responsiveUtils.isMobile(context) | ||
? Theme.of(context).textTheme.labelLarge?.copyWith( | ||
fontWeight: FontWeight.w500, | ||
color: LinagoraRefColors.material().tertiary[20], | ||
) | ||
: Theme.of(context).textTheme.bodyLarge?.copyWith( | ||
fontWeight: FontWeight.w500, | ||
color: LinagoraRefColors.material().tertiary[20], | ||
); | ||
|
||
static ButtonStyle buttonStyle(BuildContext context) => ButtonStyle( | ||
iconSize: MaterialStateProperty.all<double>(18), | ||
textStyle: MaterialStateProperty.all( | ||
Theme.of(context).textTheme.labelLarge?.copyWith( | ||
fontWeight: FontWeight.w500, | ||
color: Theme.of(context).colorScheme.onPrimary, | ||
), | ||
), | ||
backgroundColor: MaterialStateProperty.all<Color>( | ||
Theme.of(context).colorScheme.primary, | ||
), | ||
foregroundColor: MaterialStateProperty.all<Color>( | ||
Theme.of(context).colorScheme.onPrimary, | ||
), | ||
shape: MaterialStateProperty.all<RoundedRectangleBorder>( | ||
RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(100), | ||
), | ||
), | ||
); | ||
|
||
static const double textsGap = 12.0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters