Skip to content
Snippets Groups Projects
Unverified Commit 1f61c20d authored by Daesslohnt's avatar Daesslohnt Committed by GitHub
Browse files

Merge pull request #2 from United-AI/home_page_Chaitanya

Home page chaitanya
parents 431c77cc 26407183
No related branches found
No related tags found
No related merge requests found
Showing
with 696 additions and 10 deletions
assets/defaultProfilePicture.png

23.3 KiB

import 'package:deggendorf_app/bottom_navigation_bar_buttons/home_page/list_of_widgets_for_home_page.dart';
import 'package:deggendorf_app/bottom_navigation_bar_buttons/home_page/weather/current_weather.dart';
import 'package:deggendorf_app/main.dart';
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MyStatefulWidget(),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
List<int> bottom = <int>[0];
@override
Widget build(BuildContext context) {
const Key centerKey = ValueKey<String>('bottom-sliver-list');
return Scaffold(
appBar: AppBar(
title: const Text('Deggendorf App'),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Drawer Header'),
),
ListTile(
title: const Text('Option 1'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SecondRoute()));
},
),
ListTile(
title: const Text('Option 2'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SecondRoute()));
},
),
],
),
),
body: CustomScrollView(
center: centerKey,
slivers: <Widget>[
SliverList(
key: centerKey,
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return new InkWell(
onTap: () {
if (index == 0) {
//If the widget tapped is the weather widget, then open weather page :)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CurrentWeather()),
);
}
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20)),
height: 125,
child: new MyList(context).myList[index],
));
},
childCount: new MyList(context).myList.length,
),
),
],
),
);
}
}
import 'package:deggendorf_app/bottom_navigation_bar_buttons/home_page/weather/current_weather.dart';
import 'package:flutter/cupertino.dart';
class MyList {
List<Widget> myList = [];
MyList(BuildContext buildContext) {
myList = [
actualWeatherContainer(buildContext),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
Text("Input your widget here"),
];
}
}
......@@ -22,50 +22,65 @@ class _CurrentWeatherState extends State<CurrentWeather> {
appBar: AppBar(
title: const Text("Deggendorf"),
),
body:
Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 56,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/chuttersnap-TSgwbumanuE-unsplash1.jpg'),
fit: BoxFit.cover)),
child: FutureBuilder(
builder: (buildContext, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
weather = snapshot.data as WeatherData;
if (weather == null) {
return const Text("Error getting weather");
} else {
return weatherBox(weather);
}
} else {
return const CircularProgressIndicator();
}
},
future: getCurrentWeather(),
),
)
])));
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
flex: 1,
fit: FlexFit.loose,
child: actualWeatherContainer(context))
])));
}
}
Container actualWeatherContainer(BuildContext context) {
late WeatherData weather;
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/chuttersnap-TSgwbumanuE-unsplash1.jpg'),
fit: BoxFit.cover)),
child: FutureBuilder(
builder: (buildContext, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
weather = snapshot.data as WeatherData;
if (weather == null) {
return const Text("Error getting weather");
} else {
return weatherBox(weather);
}
} else {
return const CircularProgressIndicator();
}
},
future: getCurrentWeather(),
),
);
}
Widget weatherBox(WeatherData weather) {
return Column(children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(0, 150, 0, 0),
child: Text("${weather.temperature}°C",
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
//padding: const EdgeInsets.fromLTRB(0, 150, 0, 0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text("${weather.temperature}°C",
style: GoogleFonts.dancingScript(
fontSize: 65,
color: Color.fromRGBO(0, 0, 139, 0.7),
fontWeight: FontWeight.bold))),
Text("${weather.description}",
style: GoogleFonts.pacifico(
fontSize: 30, color: Color.fromRGBO(0, 0, 139, 0.7))),
fontWeight: FontWeight.bold)),
Text("${weather.description}",
style: GoogleFonts.pacifico(
fontSize: 30, color: Color.fromRGBO(0, 0, 139, 0.7)))
],
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 50, 0, 0),
padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Text("Feels:${weather.feelsLike}°C",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15))),
Text("Highest: ${weather.high}°C Lowest: ${weather.low}°C",
......
import 'package:flutter/material.dart';
import 'package:deggendorf_app/bottom_navigation_bar_buttons/settings/settings.dart';
class Profile extends StatefulWidget {
const Profile({Key? key}) : super(key: key);
@override
_ProfilePage createState() => _ProfilePage();
}
/*
profile Page
*/
class _ProfilePage extends State<Profile> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Konto'),
actions: <Widget>[
IconButton(onPressed:(){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const SettingScreen()),
);
}, icon: Icon(Icons.settings))
],
backgroundColor: Colors.brown,
),
body: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(30),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.brown, shape: BoxShape.rectangle),
child: Padding(
padding: const EdgeInsets.all(5),
child: Text(
"Example Username",
maxLines: 2,
textScaleFactor: 2,
textAlign: TextAlign.center,
),
)),
),
Container(
alignment: Alignment.center,
decoration:
BoxDecoration(color: Colors.brown, shape: BoxShape.circle),
child: Padding(
padding: const EdgeInsets.all(5),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.brown,
backgroundImage:
AssetImage('assets/defaultProfilePicture.png'),
),
)),
Padding(
padding: const EdgeInsets.fromLTRB(30, 10, 30, 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ProfileEntry(
category: "Name", description: "Very long example Name"),
ProfileEntry(category: "Age", description: "123"),
ProfileEntry(category: "Birthday", description: "12.34.")
],
),
)
],
),
//const Center(child: Text("Diese Seite wurde noch nicht entwickelt!!!")),
);
}
}
class ProfileEntry extends StatefulWidget {
var category;
var description;
ProfileEntry({Key? key, required this.category, required this.description})
: super(key: key);
@override
_ProfileEntryState createState() => _ProfileEntryState();
}
class _ProfileEntryState extends State<ProfileEntry> {
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: () { },
style: TextButton.styleFrom(primary: Colors.brown),
child: Row(
children: [
Expanded(
flex: 30,
child: Container(
padding: EdgeInsets.fromLTRB(0, 5, 10, 5),
child: Text(
widget.category + ":",
textAlign: TextAlign.right,
),
),
),
Expanded(
flex: 70,
child: Container(
padding: const EdgeInsets.fromLTRB(10, 5, 0, 5),
child: Text(widget.description),
),
)
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DropdownSettingButton extends StatefulWidget {
const DropdownSettingButton({Key? key}) : super(key: key);
@override
State<DropdownSettingButton> createState() => _DropdownSettingButtonState();
}
class _DropdownSettingButtonState extends State<DropdownSettingButton> {
bool _expanded = false;
String currentCity = "Die aktuelle Stadt ändern";
String getCurrentCity(){
getCurrentCityFromSharedPreferences();
return currentCity;
}
getCurrentCityFromSharedPreferences() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String val = prefs.getString('currentCity') ?? "Not Selected";
currentCity = val;
}
setCurrentCityInSharedPreferences(String newCity) async{
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString('currentCity', newCity);
}
@override
Widget build(BuildContext context) {
return ExpansionPanelList(
animationDuration: Duration(microseconds: 2000),
children:[
ExpansionPanel(
canTapOnHeader: true,
isExpanded: _expanded,
headerBuilder: (context, isExpanded){
String city = getCurrentCity();
return ListTile(
title: Text(city,
style: TextStyle(fontSize: 20, color: Color.fromRGBO(
1, 1, 1, 0.5))
),
);
},
body: Column(
children: <Widget> [
TextButton(
onPressed: (){
setCurrentCityInSharedPreferences("Deggendorf");
_expanded = false;
getCurrentCityFromSharedPreferences();
setState(() {
});
},
child: Text(
"Deggendorf",
style: TextStyle(fontSize: 20, color: Color.fromRGBO(
1, 1, 1, 0.5)),
)
),
TextButton(
onPressed: (){
setCurrentCityInSharedPreferences("Plattling");
_expanded = false;
getCurrentCityFromSharedPreferences();
setState(() {
});
},
child: Text(
"Plattling",
style: TextStyle(fontSize: 20, color: Color.fromRGBO(
1, 1, 1, 0.5)),
)
),
],
)
)
],
expansionCallback: (panelIndex, isExpanded){
_expanded = !_expanded;
setState(() {
});
},
);
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:deggendorf_app/bottom_navigation_bar_buttons/settings/dropdownbutton.dart';
import 'package:deggendorf_app/bottom_navigation_bar_buttons/settings/standardsettingbutton.dart';
class SettingScreen extends StatelessWidget {
const SettingScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.pink,
title: Text(
"Einstellungen",
style: TextStyle(fontSize: 25, color: Colors.white),
),
),
body: Container(
padding: EdgeInsets.all(8),
child: ListView(
children: [
StandardSettingButton(xOffset: 150, title: "Kennwort", label: "",),
StandardSettingButton(xOffset: 127, title: "Benutzername", label: ""),
DropdownSettingButton()
],
),
),
);
}
}
import 'package:flutter/material.dart';
class StandardSettingButton extends StatefulWidget {
const StandardSettingButton({Key? key,
required this.xOffset,
required this.title,
required this.label
}) : super(key: key);
final double xOffset;
final String title;
final String label;
@override
State<StandardSettingButton> createState() => _StandardSettingButtonState();
}
class _StandardSettingButtonState extends State<StandardSettingButton> {
bool isPassword(){
if (widget.title == "Kennwort"){
return true;
}
return false;
}
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: (){
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(
"Wollen Sie ${widget.title} ändern?",
style: TextStyle(
fontSize: 16
),
),
content: TextField(
obscureText: isPassword() ,
decoration: InputDecoration(
hintText: "geben Sie ${widget.title} ein"
),
),
actions: [
TextButton(
onPressed: (){Navigator.pop(context);},
child: Text("ändern")
),
TextButton(
onPressed: (){
Navigator.pop(context);
},
child: Text("abbrechen")
)
],
),
);
},
child: Row(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.title,
style: TextStyle(fontSize: 25, color: Color.fromRGBO(
1, 1, 1, 0.5)),
),
Text(
"drücken um das ${widget.title} zu ändern",
style: TextStyle(fontSize: 10, color: Color.fromRGBO(
1, 1, 1, 0.37)),
)
],
),
SizedBox(
width: widget.xOffset,
),
Icon(
Icons.keyboard_arrow_right_rounded,
color: Color.fromRGBO(1, 1, 1, 0.5),
size: 40,
)
],
)
);
}
}
\ No newline at end of file
//
// Generated file. Do not edit.
//
// ignore_for_file: directives_ordering
// ignore_for_file: lines_longer_than_80_chars
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
SharedPreferencesPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
import 'package:deggendorf_app/bottom_navigation_bar_buttons/weather/current_weather.dart';
import 'package:deggendorf_app/bottom_navigation_bar_buttons/home_page/home_page.dart';
import 'package:flutter/material.dart';
import 'bottom_navigation_bar_buttons/forum/forum.dart';
import 'bottom_navigation_bar_buttons/profile/profile.dart';
import 'bottom_navigation_bar_buttons/profile/profile.dart';
import 'bottom_navigation_bar_buttons/home_page/weather/current_weather.dart';
void main() {
runApp(const MyApp());
......@@ -43,15 +46,14 @@ class _MyHomePageState extends State<MyHomePage> {
*/
static const List<Widget> _widgetOptions = <Widget>[
//Index: 0
CurrentWeather(),
HomePage(),
//Index: 1,
SecondRoute(),
//Index: 2,
Forum(),
//Index: 3
SecondRoute(),
Profile(),
//Index: 4
SecondRoute()
];
void _onItemTapped(int index) {
......@@ -71,6 +73,7 @@ class _MyHomePageState extends State<MyHomePage> {
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
/*
From here are the bottom navigation bar's buttons
Each button has an icon, a label and a colour, each of which are optional
......@@ -97,11 +100,6 @@ class _MyHomePageState extends State<MyHomePage> {
label: 'Konto',
backgroundColor: Colors.brown,
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Einstellung',
backgroundColor: Colors.pink,
),
],
currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
......
......@@ -90,11 +90,30 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_material_color_picker:
dependency: transitive
description:
name: flutter_material_color_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0+2"
flutter_settings_screens:
dependency: "direct main"
description:
name: flutter_settings_screens
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.2+1"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
google_fonts:
dependency: "direct dev"
description:
......@@ -116,6 +135,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
lints:
dependency: transitive
description:
......@@ -144,6 +170,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
path:
dependency: transitive
description:
......@@ -200,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
platform:
dependency: transitive
description:
......@@ -221,6 +261,69 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
shared_preferences_ios:
dependency: transitive
description:
name: shared_preferences_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
sky_engine:
dependency: transitive
description: flutter
......@@ -288,7 +391,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.4"
version: "2.5.1"
xdg_directories:
dependency: transitive
description:
......
......@@ -36,6 +36,8 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.4
http: ^0.13.4
flutter_settings_screens: ^0.2.2+1
shared_preferences: ^2.0.13
dev_dependencies:
flutter_test:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment