Item View
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
|
||||
class ItemMagLarge extends StatelessWidget {
|
||||
const ItemMagLarge({
|
||||
Key key,
|
||||
this.magazine,
|
||||
}) : super(key: key);
|
||||
|
||||
final Magazine magazine;
|
||||
|
||||
@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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
|
||||
import 'item_mag_small.dart';
|
||||
|
||||
class ItemMagRow extends StatelessWidget {
|
||||
const ItemMagRow({
|
||||
Key key,
|
||||
this.rowTitle,
|
||||
this.magazines,
|
||||
}) : super(key: key);
|
||||
|
||||
final String rowTitle;
|
||||
final List<Magazine> magazines;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverToBoxAdapter(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16, top: 26),
|
||||
child: Text(
|
||||
rowTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 170,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: magazines.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: ItemMagSmall(
|
||||
magazine: magazines[index],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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 'item_mag_small.dart';
|
||||
|
||||
class ItemMagRowNewest extends StatelessWidget {
|
||||
const ItemMagRowNewest({
|
||||
Key key,
|
||||
this.magazines,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<Magazine> magazines;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SliverToBoxAdapter(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16, top: 26),
|
||||
child: Text(
|
||||
"Nouveautés",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 235,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: magazines.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: ItemMagLarge(
|
||||
magazine: magazines[index],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||
import 'package:le_kiosque_by_gcs/ui/pdf_reader.dart';
|
||||
|
||||
class ItemMagSmall extends StatelessWidget {
|
||||
const ItemMagSmall({Key key, this.magazine}) : super(key: key);
|
||||
|
||||
final Magazine magazine;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
showPdfReader(context, magazine.magazineUrl);
|
||||
},
|
||||
child: Container(
|
||||
height: 167,
|
||||
width: 119,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showPdfReader(BuildContext context, String magazineUrl) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return PdfReader(
|
||||
pdfUrl: "http://www.africau.edu/images/default/sample.pdf",
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProfilePicture extends StatelessWidget {
|
||||
|
||||
const ProfilePicture({Key key, this.imageUrl}) : super(key: key);
|
||||
|
||||
final String imageUrl;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 114,
|
||||
width: 114,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
border: Border.all(
|
||||
color: Colors.white,
|
||||
width: 4,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 2,
|
||||
offset: Offset(0, 1), // changes position of shadow
|
||||
)
|
||||
]
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class EditProfileView extends StatefulWidget {
|
||||
@override
|
||||
_EditProfileViewState createState() => _EditProfileViewState();
|
||||
}
|
||||
|
||||
class _EditProfileViewState extends State<EditProfileView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
iconTheme: IconThemeData(
|
||||
color: Color(0xFF545454), //change your color here
|
||||
)
|
||||
),
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+19
-1
@@ -1,8 +1,26 @@
|
||||
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 Container();
|
||||
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()]),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ class _MainViewState extends State<MainView> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
title: Text(
|
||||
_labels[_selectedIndex],
|
||||
style: TextStyle(
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PdfReader extends StatefulWidget {
|
||||
const PdfReader({
|
||||
Key key,
|
||||
this.pdfUrl,
|
||||
}) : super(key: key);
|
||||
|
||||
final String pdfUrl;
|
||||
|
||||
@override
|
||||
_PdfReaderState createState() => _PdfReaderState();
|
||||
}
|
||||
|
||||
class _PdfReaderState extends State<PdfReader> {
|
||||
bool isLoading = true;
|
||||
PDFDocument document;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadDocument();
|
||||
}
|
||||
|
||||
loadDocument() async {
|
||||
try {
|
||||
document = await PDFDocument.fromURL('https://pdftron.s3.amazonaws.coQm/downloads/pdfref.pdf');
|
||||
setState(() => isLoading = false);
|
||||
} catch(e) {
|
||||
print(e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
iconTheme: IconThemeData(
|
||||
color: Color(0xFF545454), //change your color here
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: isLoading
|
||||
? CircularProgressIndicator()
|
||||
: PDFViewer(document: document),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+99
-13
@@ -1,5 +1,8 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.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';
|
||||
|
||||
class ProfileView extends StatefulWidget {
|
||||
@override
|
||||
@@ -10,19 +13,102 @@ class _ProfileViewState extends State<ProfileView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"Mon Profil",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
leading: Builder(builder: (BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 16),
|
||||
child: Image.asset("assets/images/kiosque_logo.png"),
|
||||
);
|
||||
}),
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
_buildProfileHeader(),
|
||||
SizedBox(height: 48),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
top: 34,
|
||||
right: 16,
|
||||
bottom: 16,
|
||||
),
|
||||
child: Text(
|
||||
"A lire plus tard",
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Text("ssdsfdss")
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Container(),
|
||||
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,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProfileBody() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF8F8F8),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(30),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProfileHeader() {
|
||||
final imageUrl = FirebaseAuth.instance.currentUser.photoURL;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: ProfilePicture(imageUrl: imageUrl),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Eric Ampire",
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.location_on,
|
||||
color: Color(0xFFA5A5A5),
|
||||
size: 17,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Lubumbashi",
|
||||
style: TextStyle(color: Colors.grey),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_showEditProfileView(BuildContext context) {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (BuildContext context) => EditProfileView(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user