Card statt ListTile. Bessere anpassung der Elemente möglich. Endlich größere Bilder (i cry) Außerdem Abstand zwischen den Elementen besser erkenntlich durch ein Padding
This commit is contained in:
+52
-31
@@ -1,6 +1,3 @@
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'DetailPage.dart';
|
||||
@@ -20,42 +17,65 @@ class UserDefinedItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
String shortDescription = "${description.substring(0, 30)}...";
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 20, // beliebige Schriftgröße
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
shortDescription,
|
||||
style: const TextStyle(
|
||||
fontSize: 14, // beliebige Schriftgröße
|
||||
),
|
||||
),
|
||||
leading: Container(
|
||||
child: image,
|
||||
),
|
||||
onTap: () {
|
||||
// Open a new window when the user taps on the list item
|
||||
Navigator.push(
|
||||
padding: const EdgeInsets.symmetric(vertical: 1.0),
|
||||
child: Card(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
// Open a new screen when the user taps on the list item
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DetailPage(
|
||||
title: title,
|
||||
description: description,
|
||||
image: image,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DetailPage(
|
||||
title: title,
|
||||
description: description,
|
||||
image: image,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 130,
|
||||
height: 130,
|
||||
child: image,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 24, // beliebige Schriftgröße
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
shortDescription,
|
||||
style: const TextStyle(
|
||||
fontSize: 18, // beliebige Schriftgröße
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class NewsList extends StatelessWidget {
|
||||
const NewsList({super.key});
|
||||
|
||||
@@ -132,3 +152,4 @@ class IssueList extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-31
@@ -1,7 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
|
||||
import 'UserDefinedList.dart';
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
@@ -20,20 +17,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
|
||||
static const TextStyle optionStyle =
|
||||
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
||||
|
||||
/*static /*const*/ final List<Widget> _widgetOptions = <Widget>[
|
||||
/*Text(
|
||||
'Index 0: News',
|
||||
style: optionStyle,
|
||||
),*/
|
||||
NewsList(),
|
||||
IssueList(),
|
||||
const Text(
|
||||
'Index 2: Profil',
|
||||
style: optionStyle,
|
||||
)
|
||||
];*/
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
@@ -48,14 +31,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> _widgetOptions = <Widget>[
|
||||
NewsList(),
|
||||
login ? IssueList() : Container(
|
||||
child: const Text(
|
||||
'Mängel (nur für angemeldete Benutzer verfügbar)',
|
||||
style: optionStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
final List<Widget> widgetOptions = <Widget>[
|
||||
const NewsList(),
|
||||
login ? const IssueList() : const Text(
|
||||
'Mängel (nur für angemeldete Benutzer verfügbar)',
|
||||
style: optionStyle,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -74,17 +55,15 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
),
|
||||
];
|
||||
|
||||
/*const Text(
|
||||
'Index 2: Profil',
|
||||
style: optionStyle,
|
||||
)*/
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Oggauer Gemeinde Trommler'),
|
||||
|
||||
|
||||
),
|
||||
body: Center(
|
||||
child: _widgetOptions.elementAt(_selectedIndex),
|
||||
child: widgetOptions.elementAt(_selectedIndex),
|
||||
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
items: const <BottomNavigationBarItem>
|
||||
|
||||
Reference in New Issue
Block a user