diff --git a/lib/DetailPage.dart b/lib/DetailPage.dart index b20e089..155ccb4 100644 --- a/lib/DetailPage.dart +++ b/lib/DetailPage.dart @@ -1,4 +1,74 @@ import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class DetailPage extends StatelessWidget { + final String title; + final String datum; + final String description; + final Image? image; + + const DetailPage({ + Key? key, + required this.title, + required this.datum, + required this.description, + required this.image, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(title), + ), + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.all(8.0), + child: image, + ), + Container( + padding: const EdgeInsets.all(8.0), + child: Text( + title, + style: const TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + padding: const EdgeInsets.only(left: 8.0, bottom: 8.0), + child: Text( + datum, + style: const TextStyle( + fontSize: 18, + ), + ), + ), + Container( + padding: const EdgeInsets.all(8.0), + child: Text( + description, + style: const TextStyle( + fontSize: 18, + ), + ), + ), + ], + ), + ), + ); + } +} + + + + + +/*import 'package:flutter/material.dart'; class DetailPage extends StatelessWidget { final String title; @@ -48,4 +118,5 @@ class DetailPage extends StatelessWidget { ), ); } -} +}*/ + diff --git a/lib/UserDefinedList.dart b/lib/UserDefinedList.dart index e18701e..2299caa 100644 --- a/lib/UserDefinedList.dart +++ b/lib/UserDefinedList.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:cloud_firestore/cloud_firestore.dart'; import 'DetailPage.dart'; import 'package:intl/intl.dart'; @@ -19,73 +18,74 @@ class UserDefinedItem extends StatelessWidget { @override Widget build(BuildContext context) { - String shortDescription = "${description.substring(0,34)}..."; - - return Padding( - 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 != null ? image! : null, - ), + return 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, + datum: datum, + description: description, + image: image != null ? image! : null, ), - ); - }, - child: Row( - children: [ - SizedBox( - width: 130, - height: 130, - child: image, - ), - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Text( - title, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 20, // beliebige Schriftgröße - ), - ), - ), - Text( - datum, + ), + ); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: 120, + height: 120, + child: image, + ), + Flexible( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: Text( + title, + overflow: TextOverflow.ellipsis, style: const TextStyle( - fontSize: 16, // beliebige Schriftgröße + fontSize: 20, + fontWeight: FontWeight.bold// beliebige Schriftgröße ), ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - shortDescription, - style: const TextStyle( - fontSize: 18, // beliebige Schriftgröße ), + Text( + datum, + style: const TextStyle( + fontSize: 15, // beliebige Schriftgröße + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), // feste Höhe für 2 Zeilen + child: Text( + description, + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 15, ), ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), ), ); @@ -191,16 +191,13 @@ class IssueList extends StatelessWidget { //addUDI(item1); //addUDI(item2); return ListView( - children: _items.map((item) => UserDefinedItem( + children: _items.map((item) => UserDefinedItem( title: item.title, datum: item.datum, description: item.description, image: item.image, - ), - ).toList(), + ), + ).toList(), ); } -} - - - +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 47a95fe..91f7223 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,7 @@ name: demoapp description: test app + # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev @@ -31,6 +32,8 @@ environment: dependencies: flutter: sdk: flutter + intl: ^0.17.0 + # The following adds the Cupertino Icons font to your application. @@ -42,6 +45,7 @@ dependencies: firebase_storage: ^11.1.0 cloud_firestore: ^4.5.1 + dev_dependencies: flutter_test: sdk: flutter