Profile View
This commit is contained in:
@@ -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),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user