Profile View
This commit is contained in:
+11
-3
@@ -2,7 +2,10 @@ import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
|
||||
import 'package:le_kiosque_by_gcs/services/auth/main_auth.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/landing.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/landing.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'services/auth/auth.dart';
|
||||
|
||||
void main() async {
|
||||
await Settings.init(cacheProvider: SharePreferenceCache());
|
||||
@@ -20,9 +23,14 @@ class MyApp extends StatelessWidget {
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: LandingPageView(
|
||||
auth: MainAuth(),
|
||||
home: MultiProvider(
|
||||
providers: [
|
||||
Provider<Auth>(create: (_) => MainAuth())
|
||||
],
|
||||
child: LandingPageView(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class Magazine {
|
||||
final String uid;
|
||||
final String title;
|
||||
@@ -19,9 +21,9 @@ class Magazine {
|
||||
this.publishedAt,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.summaryText,
|
||||
@required this.summaryText,
|
||||
this.summaryUrl,
|
||||
this.magazineUrl,
|
||||
@required this.magazineUrl,
|
||||
this.uidCategory,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Future<bool> showAlertDialog({
|
||||
BuildContext context,
|
||||
@required String title,
|
||||
@required String contentMessage,
|
||||
String confirmText,
|
||||
String cancelText,
|
||||
}) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(contentMessage),
|
||||
actions: [
|
||||
if (cancelText != null)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
child: Text(cancelText),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: Text(confirmText),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,28 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/pdf_reader.dart';
|
||||
|
||||
class ItemMagLarge extends StatelessWidget {
|
||||
const ItemMagLarge({
|
||||
Key key,
|
||||
this.magazine,
|
||||
@required this.magazine,
|
||||
}) : super(key: key);
|
||||
|
||||
final Magazine magazine;
|
||||
|
||||
void showPdfReader(BuildContext context, String magazineUrl) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return PdfReader(
|
||||
pdfUrl: magazine.magazineUrl,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 235,
|
||||
width: 168,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5)
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://miningandbusiness.com/wp-content/uploads/2021/02/03f19c3a-1d92-4be7-ac54-f52b37e626ad-561x771.jpg"),
|
||||
fit: BoxFit.cover,
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
showPdfReader(context, magazine.magazineUrl);
|
||||
},
|
||||
child: Container(
|
||||
height: 235,
|
||||
width: 168,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(magazine.urlCover),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/detailmag/detail_mag.dart';
|
||||
|
||||
import 'item_mag_small.dart';
|
||||
|
||||
showDetailCategoryMagazine({
|
||||
BuildContext context,
|
||||
List<Magazine> magazines,
|
||||
String rowTitle,
|
||||
}) {
|
||||
showBottomSheet(
|
||||
//barrierColor: Colors.black87,
|
||||
backgroundColor: Colors.black87,
|
||||
context: context,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
builder: (builder) {
|
||||
return DetailMagazine(
|
||||
magazines: magazines,
|
||||
toolbarTitle: rowTitle,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class ItemMagRow extends StatelessWidget {
|
||||
const ItemMagRow({
|
||||
Key key,
|
||||
@@ -22,11 +42,27 @@ class ItemMagRow extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16, top: 26),
|
||||
child: Text(
|
||||
rowTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
rowTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => showDetailCategoryMagazine(
|
||||
context: context,
|
||||
magazines: magazines,
|
||||
rowTitle: rowTitle,
|
||||
),
|
||||
child: Text(
|
||||
'Détails',
|
||||
style: TextStyle(fontSize: 16, color: Color(0xFF25ADF3)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_large.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/detailmag/detail_mag.dart';
|
||||
|
||||
import 'item_mag_row.dart';
|
||||
import 'item_mag_small.dart';
|
||||
|
||||
class ItemMagRowNewest extends StatelessWidget {
|
||||
@@ -11,6 +13,8 @@ class ItemMagRowNewest extends StatelessWidget {
|
||||
}) : super(key: key);
|
||||
|
||||
final List<Magazine> magazines;
|
||||
final title = "Nouveautés";
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -21,11 +25,27 @@ class ItemMagRowNewest extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16, top: 26),
|
||||
child: Text(
|
||||
"Nouveautés",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => showDetailCategoryMagazine(
|
||||
context: context,
|
||||
magazines: magazines,
|
||||
rowTitle: title,
|
||||
),
|
||||
child: Text(
|
||||
'Détails',
|
||||
style: TextStyle(fontSize: 16, color: Color(0xFF25ADF3)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/pdf_reader.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/pdf_reader.dart';
|
||||
|
||||
class ItemMagSmall extends StatelessWidget {
|
||||
const ItemMagSmall({Key key, this.magazine}) : super(key: key);
|
||||
@@ -20,8 +21,7 @@ class ItemMagSmall extends StatelessWidget {
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://miningandbusiness.com/wp-content/uploads/2021/02/03f19c3a-1d92-4be7-ac54-f52b37e626ad-561x771.jpg"),
|
||||
image: NetworkImage(magazine.urlCover),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
@@ -34,7 +34,7 @@ class ItemMagSmall extends StatelessWidget {
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return PdfReader(
|
||||
pdfUrl: "http://www.africau.edu/images/default/sample.pdf",
|
||||
pdfUrl: magazine.magazineUrl,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row_newest.dart';
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
ItemMagRowNewest(magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
ItemMagRow(rowTitle: "Buzzz Magazine", magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
ItemMagRow(rowTitle: "Hamaji Magazine", magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
ItemMagRow(rowTitle: "Mining and buziness", magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
ItemMagRow(rowTitle: "Declic Car Magazine", magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
ItemMagRow(rowTitle: "Congo Airways", magazines: [Magazine(), Magazine(), Magazine(), Magazine(), Magazine(), Magazine()]),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
|
||||
|
||||
class SettingView extends StatelessWidget {
|
||||
@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: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
"Compte",
|
||||
style: TextStyle(
|
||||
fontSize: 23,
|
||||
color: Color(0xFFA7A7A7),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
|
||||
child: Text(
|
||||
"Changer le mot de passe",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
//Text("Changer le mot de passe")
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class SubscriptionView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/services/auth/auth.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'custom/custom_elevated_button.dart';
|
||||
import '../custom/custom_elevated_button.dart';
|
||||
|
||||
class AuthView extends StatelessWidget {
|
||||
const AuthView({Key key, this.auth}) : super(key: key);
|
||||
final Auth auth;
|
||||
|
||||
Future<void> _signWithGoogle() async {
|
||||
|
||||
Future<void> _signWithGoogle(context) async {
|
||||
final auth = Provider.of<Auth>(context, listen: false);
|
||||
try {
|
||||
await auth.signInWithGoogle();
|
||||
} catch (e) {
|
||||
@@ -15,7 +16,8 @@ class AuthView extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _signInWithFacebook() async {
|
||||
Future<void> _signInWithFacebook(context) async {
|
||||
final auth = Provider.of<Auth>(context, listen: false);
|
||||
try {
|
||||
await auth.signInWithFacebook();
|
||||
} catch (e) {
|
||||
@@ -74,7 +76,7 @@ class AuthView extends StatelessWidget {
|
||||
imageAsset: "assets/images/google_logo.png",
|
||||
color: Colors.white,
|
||||
textColor: Colors.black,
|
||||
onPressed: _signWithGoogle,
|
||||
onPressed: () => _signWithGoogle(context),
|
||||
text: "Se connecter avec Google",
|
||||
),
|
||||
SizedBox(height: 24),
|
||||
@@ -82,7 +84,7 @@ class AuthView extends StatelessWidget {
|
||||
imageAsset: "assets/images/facebook_logo.png",
|
||||
color: Color(0xFF334D92),
|
||||
textColor: Colors.white,
|
||||
onPressed: _signInWithFacebook,
|
||||
onPressed: () => _signInWithFacebook(context),
|
||||
text: "Se connecter avec Facebook",
|
||||
),
|
||||
SizedBox(
|
||||
@@ -0,0 +1,88 @@
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
|
||||
class DetailMagazine extends StatefulWidget {
|
||||
final List<Magazine> magazines;
|
||||
final String toolbarTitle;
|
||||
|
||||
DetailMagazine({
|
||||
Key key,
|
||||
@required this.magazines,
|
||||
@required this.toolbarTitle,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DetailMagazineState createState() => _DetailMagazineState();
|
||||
}
|
||||
|
||||
class _DetailMagazineState extends State<DetailMagazine> {
|
||||
String _currentSummary;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_updateSummary(widget.magazines[0].summaryText);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_updateSummary(String newText) {
|
||||
setState(() {
|
||||
_currentSummary = newText;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
child: CarouselSlider.builder(
|
||||
itemCount: widget.magazines.length,
|
||||
itemBuilder: (context, index, realIndex) => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
||||
child: Container(
|
||||
height: 235,
|
||||
width: 168,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(widget.magazines[index].urlCover),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
options: CarouselOptions(
|
||||
height: 400,
|
||||
pageSnapping: true,
|
||||
enableInfiniteScroll: false,
|
||||
enlargeCenterPage: true,
|
||||
onPageChanged: (index, _) {
|
||||
_updateSummary(widget.magazines[index].summaryText);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
_currentSummary,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row_newest.dart';
|
||||
|
||||
class HomeView extends StatelessWidget {
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final summary = "Voyez ce jeu exquis wallon, de graphie en kit mais bref. Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à côté de l\"alcôve ovoïde, où les bûches se consument dans l\"âtre";
|
||||
final url = "https://miningandbusiness.com/wp-content/uploads/2021/02/03f19c3a-1d92-4be7-ac54-f52b37e626ad-561x771.jpg";
|
||||
final urlPrd = "http://www.africau.edu/images/default/sample.pdf";
|
||||
|
||||
return Scaffold(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
ItemMagRowNewest(magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
ItemMagRow(rowTitle: "Buzzz Magazine", magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
ItemMagRow(rowTitle: "Hamaji Magazine", magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
ItemMagRow(rowTitle: "Mining and buziness", magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
ItemMagRow(rowTitle: "Declic Car Magazine", magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
ItemMagRow(rowTitle: "Congo Airways", magazines: [Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary), Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)]),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
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/auth.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/main.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/auth.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/main.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LandingPageView extends StatelessWidget {
|
||||
final Auth auth;
|
||||
|
||||
const LandingPageView({Key key, this.auth}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final auth = Provider.of<Auth>(context, listen: false);
|
||||
return StreamBuilder<User>(
|
||||
stream: auth.authStateChanges(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.active) {
|
||||
if (snapshot.data == null) {
|
||||
return AuthView(auth: auth);
|
||||
return AuthView();
|
||||
} else {
|
||||
return MainView();
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/home.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/news.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/profile.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/search.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/setting.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/subscription.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/home.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/news.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/profile.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/search.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/setting/setting.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/subscription/subscription.dart';
|
||||
|
||||
class MainView extends StatefulWidget {
|
||||
@override
|
||||
@@ -34,7 +34,7 @@ class _MainViewState extends State<MainView> {
|
||||
_showSettingView(BuildContext context) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingView(),
|
||||
builder: (_) => SettingView(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class _MainViewState extends State<MainView> {
|
||||
void _showSearchView(BuildContext context) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SearchView(),
|
||||
builder: (_) => SearchView(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class _PdfReaderState extends State<PdfReader> {
|
||||
|
||||
loadDocument() async {
|
||||
try {
|
||||
document = await PDFDocument.fromURL('https://pdftron.s3.amazonaws.coQm/downloads/pdfref.pdf');
|
||||
document = await PDFDocument.fromURL('https://pdftron.s3.amazonaws.com/downloads/pdfref.pdf');
|
||||
setState(() => isLoading = false);
|
||||
} catch(e) {
|
||||
print(e);
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_large.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/custom/profile_picture.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/edit_profil.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/view/edit_profil.dart';
|
||||
|
||||
class ProfileView extends StatefulWidget {
|
||||
@override
|
||||
@@ -12,14 +13,29 @@ class ProfileView extends StatefulWidget {
|
||||
class _ProfileViewState extends State<ProfileView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO Removig
|
||||
final summary =
|
||||
"Voyez ce jeu exquis wallon, de graphie en kit mais bref. Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à côté de l\"alcôve ovoïde, où les bûches se consument dans l\"âtre";
|
||||
final url =
|
||||
"https://miningandbusiness.com/wp-content/uploads/2021/02/03f19c3a-1d92-4be7-ac54-f52b37e626ad-561x771.jpg";
|
||||
final urlPrd = "http://www.africau.edu/images/default/sample.pdf";
|
||||
|
||||
final magazines = [
|
||||
Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary),
|
||||
Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary),
|
||||
Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary),
|
||||
Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary),
|
||||
Magazine(urlCover: url, magazineUrl: urlPrd, summaryText: summary)
|
||||
];
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_buildProfileHeader(),
|
||||
SizedBox(height: 48),
|
||||
SizedBox(height: 24),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
@@ -38,20 +54,41 @@ class _ProfileViewState extends State<ProfileView> {
|
||||
],
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Text("ssdsfdss")
|
||||
)
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.all(16),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 16.0,
|
||||
crossAxisSpacing: 16.0,
|
||||
mainAxisExtent: 250
|
||||
),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, int index) => ItemMagLarge(magazine: magazines[index]),
|
||||
childCount: magazines.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling,
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
floatingActionButton: Visibility(
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () => _showEditProfileView(context),
|
||||
label: const Text('Editer', style: TextStyle(color: Color(0XFFFF567E))),
|
||||
icon: const Icon(Icons.edit, color: Color(0XFFFF567E)),
|
||||
backgroundColor: Colors.white,
|
||||
)),
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () => _showEditProfileView(context),
|
||||
label: const Text(
|
||||
'Editer',
|
||||
style: TextStyle(
|
||||
color: Color(0XFFFF567E),
|
||||
),
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.edit,
|
||||
color: Color(0XFFFF567E),
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -107,8 +144,10 @@ class _ProfileViewState extends State<ProfileView> {
|
||||
}
|
||||
|
||||
_showEditProfileView(BuildContext context) {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) => EditProfileView(),
|
||||
));
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) => EditProfileView(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SubscriptionView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 286,
|
||||
width: 317,
|
||||
child: Image.asset("assets/images/mags.png"),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Text(
|
||||
"Voyez ce jeu exquis wallon, de graphie en kit mais bref. Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à côté de l\"alcôve ovoïde, où les bûches se",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: FloatingActionButton.extended(
|
||||
onPressed: () => _buyNow(context),
|
||||
label: const Text(
|
||||
'Payer maintenant',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Color(0XFF2571F3),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buyNow(BuildContext context) {}
|
||||
}
|
||||
Reference in New Issue
Block a user