Skip to content

Commit

Permalink
feat: Ajouter les pages pre-onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
lsaudon committed May 24, 2024
1 parent d22fd77 commit 814b916
Show file tree
Hide file tree
Showing 42 changed files with 844 additions and 136 deletions.
Binary file added app/assets/images/preonboarding1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/preonboarding2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/preonboarding3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/logos/logo_ademe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/logos/logo_fnv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/logos/logo_rf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions app/lib/commencer/views/premiere_page.dart

This file was deleted.

4 changes: 0 additions & 4 deletions app/lib/l10n/l10n.dart

This file was deleted.

33 changes: 24 additions & 9 deletions app/lib/main.dart
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())),
);
}
16 changes: 16 additions & 0 deletions app/lib/src/app.dart
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,
),
);
}
6 changes: 6 additions & 0 deletions app/lib/src/assets/images.dart
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';
}
4 changes: 4 additions & 0 deletions app/lib/src/assets/svgs.dart
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';
}
17 changes: 17 additions & 0 deletions app/lib/src/l10n/l10n.dart
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 app/lib/src/pages/pre_onboarding/pre_onboarding_carrousel_page.dart
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,
),
),
],
),
),
);
}
}
61 changes: 61 additions & 0 deletions app/lib/src/pages/pre_onboarding/pre_onboarding_page.dart
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);
},
),
],
),
),
),
);
}
Loading

0 comments on commit 814b916

Please sign in to comment.