Footer auch auf der Main seite hinzugefügt
This commit is contained in:
parent
cda5b36368
commit
4e632c740c
|
|
@ -15,7 +15,8 @@ class HomePage extends StatefulWidget {
|
|||
@override
|
||||
_HomePage createState() => _HomePage();
|
||||
}
|
||||
class _HomePage extends State<HomePage> {
|
||||
|
||||
class _HomePage extends State<HomePage> {
|
||||
late Future<void> _fetchDataFuture;
|
||||
bool isScrollable = false;
|
||||
void toggleExpanded() {
|
||||
|
|
@ -23,7 +24,8 @@ class _HomePage extends State<HomePage> {
|
|||
isScrollable = !isScrollable;
|
||||
});
|
||||
}
|
||||
@override
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchDataFuture = Categories.instance.updateCategoryAmount('Ingolstadt');
|
||||
|
|
@ -104,14 +106,11 @@ class _HomePage extends State<HomePage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var size = MediaQuery.of(context).size;
|
||||
|
||||
|
||||
/*24 is for notification bar on Android*/
|
||||
|
||||
|
||||
// ScrollController und Status-Variable
|
||||
ScrollController _scrollController = ScrollController();
|
||||
|
||||
|
||||
|
||||
// Verfügbarer Bereich auf dem Bildschirm
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
|
|
@ -122,18 +121,26 @@ class _HomePage extends State<HomePage> {
|
|||
double TimeButtonpadding = 20;
|
||||
double FooterHeight = 91;
|
||||
double bottomPadding = MediaQuery.of(context).padding.bottom;
|
||||
final staticContentheight=statusBarHeight+HeaderHeight +TimeButtonHeight+TimeButtonpadding+FooterHeight+bottomPadding;
|
||||
double amaountOfCategoryLines = 4;//singleCategories.categories.length/2;
|
||||
final staticContentheight = statusBarHeight +
|
||||
HeaderHeight +
|
||||
TimeButtonHeight +
|
||||
TimeButtonpadding +
|
||||
FooterHeight +
|
||||
bottomPadding;
|
||||
double amaountOfCategoryLines = 4; //singleCategories.categories.length/2;
|
||||
double paddingHeight = 10;
|
||||
double shaddowHeight = 10;
|
||||
|
||||
final dynamicContentHeight= ((amaountOfCategoryLines+1)*paddingHeight)+ (amaountOfCategoryLines*shaddowHeight);
|
||||
final resultHeightRemove= staticContentheight+dynamicContentHeight;
|
||||
final int itemHeight = ((screenHeight - resultHeightRemove)/4).toInt();//240-90) / 4;
|
||||
final double itemWidth = (size.width-40)/ 2;
|
||||
MediaQueryData queryData;
|
||||
queryData = MediaQuery.of(context);
|
||||
|
||||
|
||||
final dynamicContentHeight =
|
||||
((amaountOfCategoryLines + 1) * paddingHeight) +
|
||||
(amaountOfCategoryLines * shaddowHeight);
|
||||
final resultHeightRemove = staticContentheight + dynamicContentHeight;
|
||||
final int itemHeight =
|
||||
((screenHeight - resultHeightRemove) / 4).toInt(); //240-90) / 4;
|
||||
final double itemWidth = (size.width - 40) / 2;
|
||||
MediaQueryData queryData;
|
||||
queryData = MediaQuery.of(context);
|
||||
|
||||
var appBar = AppBar(
|
||||
leading: SizedBox(
|
||||
height: 60,
|
||||
|
|
@ -200,176 +207,183 @@ class _HomePage extends State<HomePage> {
|
|||
),
|
||||
flexibleSpace: Container(),
|
||||
);
|
||||
var body = SafeArea(
|
||||
|
||||
child:Consumer<Categories>(
|
||||
builder: (context, singleCategories, child) {return
|
||||
SingleChildScrollView(
|
||||
var body = SafeArea(child:
|
||||
Consumer<Categories>(builder: (context, singleCategories, child) {
|
||||
return SingleChildScrollView(
|
||||
physics: isScrollable
|
||||
? AlwaysScrollableScrollPhysics()
|
||||
: NeverScrollableScrollPhysics(),
|
||||
child:Column(
|
||||
children: <Widget>[
|
||||
//Header Container
|
||||
//HeaderSection(),
|
||||
Container(height: 14),
|
||||
Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: TimeButtonSection(onToggle: toggleExpanded), // Dein Button-Bereich
|
||||
),
|
||||
GridView.builder(
|
||||
controller: _scrollController,
|
||||
physics: isScrollable
|
||||
? AlwaysScrollableScrollPhysics()
|
||||
: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap:
|
||||
true, // Damit der GridView korrekt in die Column passt
|
||||
//physics: NeverScrollableScrollPhysics(), // Deaktiviert das Scrolling des GridView
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,// Anzahl der Spalten im Grid
|
||||
//crossAxisSpacing: 10.0,
|
||||
mainAxisSpacing: 10.0,
|
||||
childAspectRatio: (itemWidth /itemHeight),
|
||||
),
|
||||
itemCount:
|
||||
singleCategories.categories.length, // Anzahl der Elemente im Grid
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
/* List<Map<String, dynamic>> events =
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
//Header Container
|
||||
//HeaderSection(),
|
||||
Container(height: 14),
|
||||
Container(
|
||||
height: 35,
|
||||
padding: const EdgeInsets.all(0),
|
||||
child: TimeButtonSection(
|
||||
onToggle: toggleExpanded), // Dein Button-Bereich
|
||||
),
|
||||
GridView.builder(
|
||||
controller: _scrollController,
|
||||
physics: isScrollable
|
||||
? AlwaysScrollableScrollPhysics()
|
||||
: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap:
|
||||
true, // Damit der GridView korrekt in die Column passt
|
||||
//physics: NeverScrollableScrollPhysics(), // Deaktiviert das Scrolling des GridView
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, // Anzahl der Spalten im Grid
|
||||
//crossAxisSpacing: 10.0,
|
||||
mainAxisSpacing: 10.0,
|
||||
childAspectRatio: (itemWidth / itemHeight),
|
||||
),
|
||||
itemCount: singleCategories
|
||||
.categories.length, // Anzahl der Elemente im Grid
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
/* List<Map<String, dynamic>> events =
|
||||
await _loadData(); */
|
||||
List<Map<String, dynamic>> events2 =
|
||||
await fetchEvents(singleCategories.categories[index].category);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Frame28(
|
||||
events: events2,
|
||||
color: singleCategories.categories[index].color,
|
||||
screen_size: queryData,
|
||||
category: singleCategories.categories[index],
|
||||
)));
|
||||
},
|
||||
child:
|
||||
SizedBox(
|
||||
width: itemWidth,
|
||||
height: itemHeight.toDouble(),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Container(
|
||||
width: itemWidth,
|
||||
height: itemHeight.toDouble(),
|
||||
decoration: ShapeDecoration(
|
||||
image: DecorationImage(
|
||||
image:
|
||||
AssetImage(singleCategories.categories[index].imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
shadows: [
|
||||
BoxShadow(
|
||||
color: singleCategories.categories[index].color,
|
||||
blurRadius: 0,
|
||||
offset: const Offset(0, 10),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 16,
|
||||
top: 15,
|
||||
child: Text(
|
||||
singleCategories.categories[index].amount.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 13,
|
||||
top: singleCategories.categories[index].textheight, //86, //TODO Bootom?
|
||||
child:
|
||||
SizedBox(
|
||||
width: itemWidth-20,// Set a fixed width or use constraints
|
||||
child: Wrap(
|
||||
children: [
|
||||
Text(
|
||||
singleCategories.categories[index].title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w800,
|
||||
height: 0,
|
||||
),
|
||||
), ],
|
||||
),),
|
||||
),
|
||||
Positioned(
|
||||
right:20,
|
||||
top:10,
|
||||
child:
|
||||
SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: Image.asset(
|
||||
singleCategories.categories[index].iconUrl,
|
||||
), ),
|
||||
|
||||
),
|
||||
Positioned(
|
||||
left: 127,
|
||||
top: 9,
|
||||
child: Container(
|
||||
width: 31,
|
||||
height: 31,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
), ),
|
||||
);
|
||||
List<Map<String, dynamic>> events2 = await fetchEvents(
|
||||
singleCategories.categories[index].category);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Frame28(
|
||||
events: events2,
|
||||
color: singleCategories
|
||||
.categories[index].color,
|
||||
screen_size: queryData,
|
||||
category:
|
||||
singleCategories.categories[index],
|
||||
)));
|
||||
},
|
||||
child: SizedBox(
|
||||
width: itemWidth,
|
||||
height: itemHeight.toDouble(),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
left: 0,
|
||||
top: 0,
|
||||
child: Container(
|
||||
width: itemWidth,
|
||||
height: itemHeight.toDouble(),
|
||||
decoration: ShapeDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(singleCategories
|
||||
.categories[index].imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8)),
|
||||
shadows: [
|
||||
BoxShadow(
|
||||
color: singleCategories
|
||||
.categories[index].color,
|
||||
blurRadius: 0,
|
||||
offset: const Offset(0, 10),
|
||||
spreadRadius: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 16,
|
||||
top: 15,
|
||||
child: Text(
|
||||
singleCategories.categories[index].amount
|
||||
.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w500,
|
||||
height: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 13,
|
||||
top: singleCategories.categories[index]
|
||||
.textheight, //86, //TODO Bootom?
|
||||
child: SizedBox(
|
||||
width: itemWidth -
|
||||
20, // Set a fixed width or use constraints
|
||||
child: Wrap(
|
||||
children: [
|
||||
Text(
|
||||
singleCategories.categories[index].title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontFamily: 'Inter',
|
||||
fontWeight: FontWeight.w800,
|
||||
height: 0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 20,
|
||||
top: 10,
|
||||
child: SizedBox(
|
||||
width: 32,
|
||||
height: 32,
|
||||
child: Image.asset(
|
||||
singleCategories.categories[index].iconUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 127,
|
||||
top: 9,
|
||||
child: Container(
|
||||
width: 31,
|
||||
height: 31,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: const BoxDecoration(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
//Body Container
|
||||
Container(
|
||||
height: 20,),
|
||||
Image.asset(
|
||||
);
|
||||
},
|
||||
),
|
||||
//Body Container
|
||||
Container(
|
||||
height: 20,
|
||||
),
|
||||
Footer(),
|
||||
/* Image.asset(
|
||||
'assets/images/FooterFooter.png', // Pfad zum Bild
|
||||
//height: 120, // Höhe des Bildes
|
||||
width: 390, // Breite des Bildes
|
||||
),
|
||||
],
|
||||
),
|
||||
);})
|
||||
);
|
||||
), */
|
||||
],
|
||||
),
|
||||
);
|
||||
}));
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: appBar,
|
||||
body: Consumer<Categories>(
|
||||
builder: (context, singleCategories, child) {return body;}),
|
||||
body: Consumer<Categories>(builder: (context, singleCategories, child) {
|
||||
return body;
|
||||
}),
|
||||
);
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1676,7 +1676,7 @@ class Footer extends StatelessWidget {
|
|||
return Container(
|
||||
//width: 390,
|
||||
//height: 90,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF2F2F2),
|
||||
|
|
|
|||
Loading…
Reference in New Issue