Adding Date selector
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
|
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DateSelector extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_DateSelectorState createState() => _DateSelectorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DateSelectorState extends State<DateSelector> {
|
||||||
|
final List<String> months = [
|
||||||
|
"Janvier",
|
||||||
|
"Février",
|
||||||
|
"Mars",
|
||||||
|
"Avril",
|
||||||
|
"Mai",
|
||||||
|
"Juin",
|
||||||
|
"Juillet",
|
||||||
|
"Aout",
|
||||||
|
"Septembre",
|
||||||
|
"Octobre",
|
||||||
|
"Novembre",
|
||||||
|
"Decembre"
|
||||||
|
];
|
||||||
|
|
||||||
|
var _selectedIndex = 0;
|
||||||
|
|
||||||
|
void _updateSelectedItem(int index) {
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SliverToBoxAdapter(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 32,
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: _buildSelector(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _buildSelector() {
|
||||||
|
return months
|
||||||
|
.asMap()
|
||||||
|
.map(
|
||||||
|
(key, value) => MapEntry(
|
||||||
|
key,
|
||||||
|
chipForRow(
|
||||||
|
label: value,
|
||||||
|
isSelected: key == _selectedIndex,
|
||||||
|
currentPosition: key,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.values
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget chipForRow({String label, bool isSelected, int currentPosition}) {
|
||||||
|
if (isSelected) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 28,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () { _updateSelectedItem(currentPosition); },
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.all(Color(0xFFFF567E)),
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(4),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return SizedBox(
|
||||||
|
height: 28,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () { _updateSelectedItem(currentPosition); },
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Color(0xFF8F8F8F),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -87,11 +87,9 @@ class AuthView extends StatelessWidget {
|
|||||||
onPressed: () => _signInWithFacebook(context),
|
onPressed: () => _signInWithFacebook(context),
|
||||||
text: "Se connecter avec Facebook",
|
text: "Se connecter avec Facebook",
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(height: 24),
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
"En vous connectant, vous acceptez nos conditions et termes d'utilisation.",
|
"En vous connectant, vous acceptez nos termes et conditions d'utilisation.",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
inherit: false,
|
inherit: false,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
|
|||||||
+8
-11
@@ -1,30 +1,27 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
import 'package:le_kiosque_by_gcs/model/magazine.dart';
|
||||||
|
import 'package:le_kiosque_by_gcs/ui/custom/date_selector.dart';
|
||||||
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row.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';
|
import 'package:le_kiosque_by_gcs/ui/custom/item_mag_row_newest.dart';
|
||||||
|
|
||||||
class HomeView extends StatelessWidget {
|
class HomeView extends StatelessWidget {
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return Scaffold(
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: [
|
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)]),
|
DateSelector(),
|
||||||
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)]),
|
ItemMagRowNewest(magazines: magazinesTest),
|
||||||
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: "Buzzz Magazine", magazines: magazinesTest),
|
||||||
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: "Hamaji Magazine", magazines: magazinesTest),
|
||||||
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: "Mining and buziness", magazines: magazinesTest),
|
||||||
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)]),
|
ItemMagRow(rowTitle: "Declic Car Magazine", magazines: magazinesTest),
|
||||||
|
ItemMagRow(rowTitle: "Congo Airways", magazines: magazinesTest),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -70,60 +70,6 @@ class ItemRegularNews extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return InkWell(
|
|
||||||
onTap: () {
|
|
||||||
_showDetailNews(context);
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
||||||
child: Card(
|
|
||||||
elevation: 4,
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 120,
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: 100,
|
|
||||||
width: 100,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.grey,
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(10),
|
|
||||||
),
|
|
||||||
image: DecorationImage(
|
|
||||||
image: NetworkImage(news.previewUrl),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.all(16.0),
|
|
||||||
child: Text(
|
|
||||||
news.title,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
maxLines: 4,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 17,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Image.network(news.sourceUrl),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showDetailNews(BuildContext context) {}
|
void _showDetailNews(BuildContext context) {}
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
|
module:
|
||||||
|
androidX: true
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
||||||
@@ -51,10 +54,12 @@ flutter:
|
|||||||
# The following line ensures that the Material Icons font is
|
# The following line ensures that the Material Icons font is
|
||||||
# included with your application, so that you can use the icons in
|
# included with your application, so that you can use the icons in
|
||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
|
generate: true
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
- assets/images/
|
- assets/images/
|
||||||
|
- lang/
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
# assets:
|
# assets:
|
||||||
|
|||||||
Reference in New Issue
Block a user