Profile View

This commit is contained in:
2021-03-22 16:49:24 +02:00
parent 8f86ec409d
commit 1381647a3d
28 changed files with 645 additions and 154 deletions
+29
View File
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class ItemLogout extends StatelessWidget {
final String title;
const ItemLogout({
Key key,
this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
fontSize: 18,
color: Color(0xFF56B4FC),
),
)
],
),
);
}
}
+28
View File
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
class ItemTitleGroup extends StatelessWidget {
const ItemTitleGroup({
Key key,
this.groupTitle,
}) : super(key: key);
final String groupTitle;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
groupTitle,
style: TextStyle(
fontSize: 23,
color: Color(0xFFA7A7A7),
),
),
),
);
}
}
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
class ItemTitleSetting extends StatelessWidget {
const ItemTitleSetting({
Key key,
this.title,
}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
fontSize: 18,
color: Colors.black,
),
),
Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.black,
)
],
),
);
}
}
+107
View File
@@ -0,0 +1,107 @@
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:le_kiosque_by_gcs/services/auth/auth.dart';
import 'package:le_kiosque_by_gcs/ui/custom/dialog.dart';
import 'package:le_kiosque_by_gcs/ui/view/about.dart';
import 'package:le_kiosque_by_gcs/ui/view/setting/item_logout.dart';
import 'package:le_kiosque_by_gcs/ui/view/setting/item_title_group.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'item_title_setting.dart';
class SettingView extends StatelessWidget {
_navigateToAboutView(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) {
return AboutView();
},
),
);
}
final String licenceUrl = "http://example.com";
_showTermAndCond(BuildContext context) async {
if (await canLaunch(licenceUrl)) {
await launch(licenceUrl);
} else {
throw 'Could not launch $licenceUrl';
}
}
_showLicence(BuildContext context) async {
if (await canLaunch(licenceUrl)) {
await launch(licenceUrl);
} else {
throw 'Could not launch $licenceUrl';
}
}
_changeLanguage(BuildContext context) async {
}
_showLogoutDialog(BuildContext context) async {
final auth = Provider.of<Auth>(context, listen: false);
final isConfirm = await showAlertDialog(
context: context,
title: "Deconnexion",
contentMessage: "Êtes-vous sûr de vouloir continuer",
confirmText: "Oui",
cancelText: "Non",
);
if (isConfirm) {
await auth.signOut();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
backgroundColor: Colors.white,
title: Text(
"Paramètres",
style: TextStyle(
color: Colors.black,
),
),
iconTheme: IconThemeData(
color: Color(0xFF545454), //change your color here
),
),
body: ListView(
children: [
ItemTitleGroup(groupTitle: "Compte"),
InkWell(
child: ItemTitleSetting(title: "Changer la langue"),
onTap: () => _changeLanguage(context),
),
ItemTitleGroup(groupTitle: "Autres"),
InkWell(
child: ItemTitleSetting(title: "Termes & Conditions"),
onTap: () => _showTermAndCond(context),
),
InkWell(
child: ItemTitleSetting(title: "Licence"),
onTap: () => _showLicence(context),
),
InkWell(
child: ItemTitleSetting(title: "A propos"),
onTap: () => _navigateToAboutView(context),
),
SizedBox(height: 16),
InkWell(
child: ItemLogout(title: "Deconnexion"),
onTap: () => _showLogoutDialog(context),
)
],
),
);
}
}