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:
@@ -11,7 +11,9 @@
|
|||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
|
||||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
while the Flutter UI initializes. After that, this theme continues
|
while the Flutter UI initializes. After that, this theme continues
|
||||||
|
|||||||
+42
-21
@@ -1,6 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'DetailPage.dart';
|
import 'DetailPage.dart';
|
||||||
@@ -20,25 +17,11 @@ class UserDefinedItem extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String shortDescription = "${description.substring(0, 30)}...";
|
String shortDescription = "${description.substring(0, 30)}...";
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
padding: const EdgeInsets.symmetric(vertical: 1.0),
|
||||||
child: ListTile(
|
child: Card(
|
||||||
title: Text(
|
child: InkWell(
|
||||||
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: () {
|
onTap: () {
|
||||||
// Open a new window when the user taps on the list item
|
// Open a new screen when the user taps on the list item
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
@@ -50,12 +33,49 @@ class UserDefinedItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
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 {
|
class NewsList extends StatelessWidget {
|
||||||
const NewsList({super.key});
|
const NewsList({super.key});
|
||||||
|
|
||||||
@@ -132,3 +152,4 @@ class IssueList extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-28
@@ -1,7 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
|
|
||||||
|
|
||||||
import 'UserDefinedList.dart';
|
import 'UserDefinedList.dart';
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
@@ -20,20 +17,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
static const TextStyle optionStyle =
|
static const TextStyle optionStyle =
|
||||||
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
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) {
|
void _onItemTapped(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedIndex = index;
|
_selectedIndex = index;
|
||||||
@@ -48,15 +31,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final List<Widget> _widgetOptions = <Widget>[
|
final List<Widget> widgetOptions = <Widget>[
|
||||||
NewsList(),
|
const NewsList(),
|
||||||
login ? IssueList() : Container(
|
login ? const IssueList() : const Text(
|
||||||
child: const Text(
|
|
||||||
'Mängel (nur für angemeldete Benutzer verfügbar)',
|
'Mängel (nur für angemeldete Benutzer verfügbar)',
|
||||||
style: optionStyle,
|
style: optionStyle,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -74,17 +55,15 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
/*const Text(
|
|
||||||
'Index 2: Profil',
|
|
||||||
style: optionStyle,
|
|
||||||
)*/
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Oggauer Gemeinde Trommler'),
|
title: const Text('Oggauer Gemeinde Trommler'),
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: _widgetOptions.elementAt(_selectedIndex),
|
child: widgetOptions.elementAt(_selectedIndex),
|
||||||
|
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: const <BottomNavigationBarItem>
|
items: const <BottomNavigationBarItem>
|
||||||
|
|||||||
Reference in New Issue
Block a user