-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Ajouter les pages pre-onboarding
- Loading branch information
Showing
42 changed files
with
844 additions
and
136 deletions.
There are no files selected for viewing
File renamed without changes.
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.
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.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:agir/src/app.dart'; | ||
import 'package:dsfr/dsfr.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
void main() { | ||
runApp(const MainApp()); | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
|
||
_registerErrorHandlers(); | ||
|
||
runApp(const App()); | ||
} | ||
|
||
class MainApp extends StatelessWidget { | ||
const MainApp({super.key}); | ||
void _registerErrorHandlers() { | ||
FlutterError.onError = (final details) { | ||
FlutterError.presentError(details); | ||
debugPrint(details.toString()); | ||
}; | ||
|
||
PlatformDispatcher.instance.onError = (final error, final stack) { | ||
debugPrint(error.toString()); | ||
return true; | ||
}; | ||
|
||
@override | ||
Widget build(final BuildContext context) => const MaterialApp( | ||
home: Scaffold( | ||
body: Center( | ||
child: Text('Hello World!'), | ||
), | ||
ErrorWidget.builder = (final details) => Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: DsfrColors.redMarianneMain472, | ||
title: const Text('An error occurred'), | ||
), | ||
body: Center(child: Text(details.toString())), | ||
); | ||
} |
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,16 @@ | ||
import 'package:agir/src/router/app_router.dart'; | ||
import 'package:dsfr/dsfr.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class App extends StatelessWidget { | ||
const App({super.key}); | ||
|
||
@override | ||
Widget build(final BuildContext context) => MaterialApp.router( | ||
routerConfig: goRouter(), | ||
theme: ThemeData( | ||
colorSchemeSeed: DsfrColors.blueFranceSun113, | ||
scaffoldBackgroundColor: Colors.white, | ||
), | ||
); | ||
} |
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,6 @@ | ||
class AssetsImages { | ||
static const franceNationVerte = 'assets/logos/logo_fnv.png'; | ||
static const preOnboarding1 = 'assets/images/preonboarding1.png'; | ||
static const preOnboarding2 = 'assets/images/preonboarding2.png'; | ||
static const preOnboarding3 = 'assets/images/preonboarding3.png'; | ||
} |
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,4 @@ | ||
class AssetsSvgs { | ||
static const republiqueFrancaise = 'assets/logos/logo_rf.svg'; | ||
static const ademe = 'assets/logos/logo_ademe.svg'; | ||
} |
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,17 @@ | ||
class Localisation { | ||
static const String commencer = 'Commencer'; | ||
static const String preOnboardingTitre = | ||
'Ensemble,\naméliorons\nnos habitudes\nau jour le jour'; | ||
static const String preOnboarding1 = | ||
'L’accompagnement personnalisé qui vous offre des solutions réalisables, **pour vous**'; | ||
static const String preOnboarding2 = | ||
'Rejoignez plus de **160 000** utilisateurs engagés'; | ||
static const String preOnboarding3 = | ||
'Faites des **économies** en instaurant des habitudes durables'; | ||
static const String preOnboardingFinTitre = | ||
'Faites un premier pas en estimant rapidement les principaux impacts de vos usages'; | ||
static const String preOnboardingFinSousTitre = | ||
'Les questions suivantes nous aideront à calculer une approximation de votre empreinte carbone et vous proposer des conseils personnalisés'; | ||
static const String suivant = 'Suivant'; | ||
static const String seConnecter = "J'ai déjà un compte"; | ||
} |
160 changes: 160 additions & 0 deletions
160
app/lib/src/pages/pre_onboarding/pre_onboarding_carrousel_page.dart
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,160 @@ | ||
import 'package:agir/src/assets/images.dart'; | ||
import 'package:agir/src/l10n/l10n.dart'; | ||
import 'package:dsfr/dsfr.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_markdown/flutter_markdown.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
class PreOnboardingCarrouselPage extends StatefulWidget { | ||
const PreOnboardingCarrouselPage({super.key}); | ||
|
||
static const name = 'pre-onboarding-carrousel'; | ||
static const path = '/$name'; | ||
static GoRoute route() => GoRoute( | ||
name: name, | ||
path: path, | ||
builder: (final context, final state) => | ||
const PreOnboardingCarrouselPage(), | ||
); | ||
|
||
@override | ||
State<PreOnboardingCarrouselPage> createState() => | ||
_PreOnboardingCarrouselPageState(); | ||
} | ||
|
||
class _PreOnboardingCarrouselPageState extends State<PreOnboardingCarrouselPage> | ||
with TickerProviderStateMixin { | ||
late final TabController _tabController; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_tabController = TabController(length: 4, vsync: this); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
_tabController.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(final BuildContext context) => Scaffold( | ||
body: Stack( | ||
alignment: AlignmentDirectional.bottomCenter, | ||
children: [ | ||
TabBarView( | ||
controller: _tabController, | ||
children: [ | ||
Polaroid( | ||
image: Image.asset(AssetsImages.preOnboarding1), | ||
titre: Localisation.preOnboarding1, | ||
), | ||
Polaroid( | ||
image: Image.asset(AssetsImages.preOnboarding2), | ||
titre: Localisation.preOnboarding2, | ||
), | ||
Polaroid( | ||
image: Image.asset(AssetsImages.preOnboarding3), | ||
titre: Localisation.preOnboarding3, | ||
), | ||
ColoredBox( | ||
color: const Color(0xFFF1ECFB), | ||
child: SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: DsfrSpacings.s2w, | ||
), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const SizedBox(height: DsfrSpacings.s8w), | ||
const Icon( | ||
DsfrIcons.businessBarChartBoxFill, | ||
color: DsfrColors.blueFranceSun113, | ||
size: 56, | ||
), | ||
const SizedBox(height: DsfrSpacings.s3w), | ||
const Text( | ||
Localisation.preOnboardingFinTitre, | ||
style: DsfrFonts.headline4, | ||
), | ||
const SizedBox(height: DsfrSpacings.s1w), | ||
const Text( | ||
Localisation.preOnboardingFinSousTitre, | ||
style: DsfrFonts.bodyMd, | ||
), | ||
const Spacer(), | ||
DsfrButton.lg( | ||
label: Localisation.suivant, | ||
onTap: () {}, | ||
), | ||
const SizedBox(height: DsfrSpacings.s3w), | ||
Center( | ||
child: DsfrLink.md( | ||
label: Localisation.seConnecter, | ||
onTap: () {}, | ||
), | ||
), | ||
const SizedBox(height: DsfrSpacings.s7w), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.only(bottom: DsfrSpacings.s2w), | ||
child: TabPageSelector( | ||
controller: _tabController, | ||
indicatorSize: 8, | ||
borderStyle: BorderStyle.none, | ||
selectedColor: DsfrColors.blueFrance113, | ||
color: DsfrColors.blueFrance975Hover, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
|
||
class Polaroid extends StatelessWidget { | ||
const Polaroid({ | ||
required this.image, | ||
required this.titre, | ||
super.key, | ||
}); | ||
|
||
final Widget image; | ||
final String titre; | ||
|
||
@override | ||
Widget build(final BuildContext context) { | ||
const p = DsfrFonts.bodyXlMedium; | ||
final strong = p.copyWith(fontWeight: FontWeight.w800); | ||
|
||
return SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.all(DsfrSpacings.s2w), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
image, | ||
const SizedBox(height: DsfrSpacings.s7w), | ||
MarkdownBody( | ||
data: titre, | ||
styleSheet: MarkdownStyleSheet( | ||
p: p, | ||
strong: strong, | ||
textAlign: WrapAlignment.center, | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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,61 @@ | ||
import 'package:agir/src/assets/images.dart'; | ||
import 'package:agir/src/assets/svgs.dart'; | ||
import 'package:agir/src/l10n/l10n.dart'; | ||
import 'package:agir/src/pages/pre_onboarding/pre_onboarding_carrousel_page.dart'; | ||
import 'package:dsfr/dsfr.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_svg/svg.dart'; | ||
import 'package:go_router/go_router.dart'; | ||
|
||
class PreOnboardingPage extends StatelessWidget { | ||
const PreOnboardingPage({super.key}); | ||
|
||
static const name = 'pre-onboarding'; | ||
static const path = '/$name'; | ||
|
||
static GoRoute route() => GoRoute( | ||
name: name, | ||
path: path, | ||
builder: (final context, final state) => const PreOnboardingPage(), | ||
); | ||
|
||
@override | ||
Widget build(final BuildContext context) => Scaffold( | ||
body: SafeArea( | ||
child: Padding( | ||
padding: const EdgeInsets.all(DsfrSpacings.s2w), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
const SizedBox(height: DsfrSpacings.s15w), | ||
const Text( | ||
Localisation.preOnboardingTitre, | ||
style: DsfrFonts.displayXs, | ||
), | ||
const SizedBox(height: DsfrSpacings.s2w), | ||
Row( | ||
children: [ | ||
SvgPicture.asset( | ||
AssetsSvgs.republiqueFrancaise, | ||
height: 53, | ||
), | ||
const SizedBox(width: DsfrSpacings.s3w), | ||
Image.asset(AssetsImages.franceNationVerte, height: 35), | ||
const SizedBox(width: DsfrSpacings.s3w), | ||
SvgPicture.asset(AssetsSvgs.ademe, height: 43), | ||
], | ||
), | ||
const Spacer(), | ||
DsfrButton.lg( | ||
label: Localisation.commencer, | ||
onTap: () async { | ||
await context.pushNamed(PreOnboardingCarrouselPage.name); | ||
}, | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} |
Oops, something went wrong.