login variable zum ein und auschalten der mängel liste (Später möglicherweise auch nutzbar für "Darf nur mängel posten wen angemeldet"

This commit is contained in:
2022-12-21 16:15:55 +01:00
parent 8ccd755737
commit 7ab6be455f
5 changed files with 77 additions and 10 deletions
+2 -1
View File
@@ -4,5 +4,6 @@
the Flutter tool needs it to communicate with the running application the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> </manifest>
+3
View File
@@ -31,4 +31,7 @@
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
</application> </application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> </manifest>
+25 -6
View File
@@ -16,19 +16,37 @@ class UserDefinedItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( return Padding(
leading: image, padding: const EdgeInsets.symmetric(vertical: 10.0),
title: Text(title), child: ListTile(
subtitle: Text(description), title: Text(
title,
style: const TextStyle(
fontSize: 24, // beliebige Schriftgröße
),
),
subtitle: Text(
description,
style: const TextStyle(
fontSize: 18, // beliebige Schriftgröße
),
),
leading: Container(
child: image,
),
),
); );
} }
} }
class NewsList extends StatelessWidget { class NewsList extends StatelessWidget {
const NewsList({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
children: [ children: [
UserDefinedItem( UserDefinedItem(
title: 'Rosalia Kapelle', title: 'Rosalia Kapelle',
@@ -48,6 +66,8 @@ class NewsList extends StatelessWidget {
} }
class IssueList extends StatelessWidget { class IssueList extends StatelessWidget {
const IssueList({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
@@ -55,9 +75,8 @@ class IssueList extends StatelessWidget {
UserDefinedItem( UserDefinedItem(
title: 'Licht ausgebrannt', title: 'Licht ausgebrannt',
description: 'Licht ist ausgebrannt in der Sebastianstraße', description: 'Licht ist ausgebrannt in der Sebastianstraße',
image: Image.network('https://www.best-of-burgenland.com/assets/img/gemeinden/oggau/oggau_feuerwehr_2022-04-12_003.jpg'), image: Image.network('https://api.ebsg.at/uploads/immo70/originals/objekt_809_oggau-am-neusiedler-see_7063_6021.jpeg',),
), ),
UserDefinedItem( UserDefinedItem(
title: 'test2', title: 'test2',
description: 'Gemeide Amt der Marktgemeinde Oggau. SPÖ regierend', description: 'Gemeide Amt der Marktgemeinde Oggau. SPÖ regierend',
+46 -2
View File
@@ -1,4 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'UserDefinedList.dart'; import 'UserDefinedList.dart';
@@ -13,9 +15,14 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _selectedIndex = 0; int _selectedIndex = 0;
bool login = false;
bool isIssueItemEnabled = true;
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>[
/*static /*const*/ final List<Widget> _widgetOptions = <Widget>[
/*Text( /*Text(
'Index 0: News', 'Index 0: News',
style: optionStyle, style: optionStyle,
@@ -26,7 +33,7 @@ class _MyHomePageState extends State<MyHomePage> {
'Index 2: Profil', 'Index 2: Profil',
style: optionStyle, style: optionStyle,
) )
]; ];*/
void _onItemTapped(int index) { void _onItemTapped(int index) {
setState(() { setState(() {
@@ -34,8 +41,45 @@ class _MyHomePageState extends State<MyHomePage> {
}); });
} }
void setLogin(bool value) {
setState(() {
login = value;
isIssueItemEnabled = value;
});
}
@override @override
Widget build(BuildContext context) { 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,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
child: Text(login ? 'Logout' : 'Login'),
onPressed: () {
setLogin(!login);
},
),
const Text(
'Index 2: Profil',
style: optionStyle,
),
],
),
];
/*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'),
+1 -1
View File
@@ -17,7 +17,7 @@ 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
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1 version: 0.0.1
environment: environment:
sdk: '>=2.18.2 <3.0.0' sdk: '>=2.18.2 <3.0.0'