Compare commits

..

4 Commits

5 changed files with 100 additions and 4 deletions

3
assets/README.md Normal file
View File

@ -0,0 +1,3 @@
# Assets
Images and other media for Buddy.

4
bin/README.md Normal file
View File

@ -0,0 +1,4 @@
# bin
Helper scripts forthose new to Flutter or for myself if I take a break and need
reminders. ;D

View File

@ -4,7 +4,7 @@ import '/var/config.dart';
import '/var/secrets.dart'; import '/var/secrets.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'dart:convert'; //import 'dart:convert';
// Generic method to hit a GET request and return the response. // Generic method to hit a GET request and return the response.
Future<String> hitAPI(String url) async { Future<String> hitAPI(String url) async {
@ -16,7 +16,7 @@ Future<String> hitAPI(String url) async {
String data = ""; String data = "";
if (response.statusCode == 200) { if (response.statusCode == 200) {
data = response.body; data = response.body;
var decodedData = jsonDecode(data); //var decodedData = jsonDecode(data);
//data = decodedData.toString(); //data = decodedData.toString();
//data = jsonEncode(decodedData); //data = jsonEncode(decodedData);
if (debugVerbose) { if (debugVerbose) {

View File

@ -1,7 +1,7 @@
// Local // Local
import 'dart:convert'; import 'dart:convert';
import '/var/secrets.dart'; //import '/var/secrets.dart';
import '/var/config.dart'; import '/var/config.dart';
import 'helpers/http.dart'; import 'helpers/http.dart';
import 'helpers/json.dart'; import 'helpers/json.dart';
@ -23,6 +23,12 @@ class MainApp extends StatefulWidget {
} }
class _MainAppState extends State<MainApp> { class _MainAppState extends State<MainApp> {
final _formKey = GlobalKey<FormState>();
String _zipcode = "";
String _city = "";
String _country = "";
String _latlong = "";
String weather = loadText; String weather = loadText;
bool keepLoading = false; bool keepLoading = false;
DateTime lastLoadTime = DateTime.now().subtract( DateTime lastLoadTime = DateTime.now().subtract(
@ -42,6 +48,80 @@ class _MainAppState extends State<MainApp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget form = Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 20,
width: 100,
child: TextFormField(
initialValue: _zipcode,
validator: (value) {
return null;
},
onSaved: (value) {
_zipcode = value!;
},
),
),
SizedBox(
height: 20,
width: 100,
child: TextFormField(
initialValue: _city,
validator: (value) {
return null;
},
onSaved: (value) {
_city = value!;
},
),
),
SizedBox(
height: 20,
width: 100,
child: TextFormField(
initialValue: _country,
validator: (value) {
return null;
},
onSaved: (value) {
_country = value!;
},
),
),
],
),
SizedBox(
height: 20,
width: 300,
child: TextFormField(
initialValue: _latlong,
validator: (value) {
return null;
},
onSaved: (value) {
_latlong = value!;
},
),
),
TextButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
}
},
child: Text("Save"),
),
],
),
);
Widget weatherLayout = Column( Widget weatherLayout = Column(
children: [Text(weather), CircularProgressIndicator()], children: [Text(weather), CircularProgressIndicator()],
); );
@ -71,7 +151,13 @@ class _MainAppState extends State<MainApp> {
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
body: Center( body: Center(
child: Column(children: [Text('Weather Today!'), weatherLayout]), child: Column(
children: [
Text('Weather Today!'),
form,
Expanded(child: weatherLayout),
],
),
), ),
), ),
); );

3
notes/README.md Normal file
View File

@ -0,0 +1,3 @@
# Notes
Any calculations, tests, or general ideas for functionality within Buddy. :)