From f72883a9fad91183500f25e3c8e382b851b8aea0 Mon Sep 17 00:00:00 2001 From: Jonathan Vi Date: Mon, 4 Apr 2022 13:25:15 -0700 Subject: [PATCH] updated main.dart - has the hollow wireframe --- main.dart | 210 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 115 insertions(+), 95 deletions(-) diff --git a/main.dart b/main.dart index 32211b7..dd3a3bc 100644 --- a/main.dart +++ b/main.dart @@ -1,122 +1,142 @@ import 'package:flutter/material.dart'; + + + void main() { runApp(MaterialApp( - initialRoute: '/', - routes: { - '/': (context) => Login(), - '/homepage': (context) => HomePage(), - '/register': (context) => Register() - }, + home: MyApp(), )); } -class Login extends StatelessWidget { +class MyApp extends StatefulWidget { + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + // + final List names = []; + + final textFieldValueHolder = TextEditingController(); + + //late final TextEditingController _names = TextEditingController(); + late final TextEditingController _payment = TextEditingController(); + + late final TextEditingController _date = TextEditingController(); + + late final TextEditingController _notifications = TextEditingController(); + + late final TextEditingController _split = TextEditingController(); + + void _calculate() { + } + + void _addnames() { + final String name = textFieldValueHolder.text; + if (name == '') { + print("empty"); + } else { + names.add(name); + print(names); + } + } + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Login'), - automaticallyImplyLeading: false, + title: const Text('Split'), + centerTitle: true, backgroundColor: Colors.yellow, ), - body: Center( - child: Column( - children: [ - RaisedButton( - child: Text('Login'), - onPressed: () { - Navigator.pushNamed(context, '/homepage'); - }, - ), - RaisedButton( - child: Text('Register'), - onPressed: (){ - Navigator.pushNamed(context, '/register'); - }, + body: Padding( + padding: EdgeInsets.all(20), + child: Column( + children: [ + const Text( + "Group Creation", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.grey, + letterSpacing: 2.0, + fontSize: 30.0, + fontWeight: FontWeight.bold, ), - ], - )), - ); - } -} - -class HomePage extends StatelessWidget{ - const HomePage({Key? key}) : super(key: key); - @override - Widget build(BuildContext context) { - return DefaultTabController( - length: 3, - child: Scaffold( - appBar: AppBar( - title: Text("SPLIT"), - backgroundColor: Colors.yellow, - automaticallyImplyLeading: false, - ), - body: TabBarView( - children: [ - Container( - child: Icon(Icons.home), ), - Container( - child: Icon(Icons.group), + PopupMenuButton( + child: const Padding( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 20, + ), + child: Text("Add Names/People"), + ), + itemBuilder: (context) => [ + PopupMenuItem( + child: TextField ( + controller: textFieldValueHolder, + keyboardType: TextInputType.name, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black), + hintText: "Enter names" + ), ), - Container( - child: Icon(Icons.account_box), + ), + ), + + TextField( + controller: _payment, + keyboardType: TextInputType.text, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black), + hintText: "Total Payment" + ), ), - ], - ), - bottomNavigationBar: TabBar( - tabs: [ - Tab( - icon: Icon(Icons.home), + TextField( + controller: _date, + keyboardType: TextInputType.datetime, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black), + hintText: "Date Payment due" + ), ), - Tab( - icon: Icon(Icons.group), + TextField( + controller: _notifications, + keyboardType: TextInputType.text, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black), + hintText: "Notifications" + ), ), - Tab( - icon: Icon(Icons.account_box), + TextField( + controller: _split, + keyboardType: TextInputType.text, + textInputAction: TextInputAction.done, + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black), + hintText: "How do you want to split?" + ), ), - ], - labelColor: Theme.of(context).primaryColor, - unselectedLabelColor: Colors.black38, - indicatorSize: TabBarIndicatorSize.label, - indicatorPadding: EdgeInsets.all(5.0), - indicatorColor: Theme.of(context).primaryColor - ), - ), - ); - } -} - -class Register extends StatelessWidget{ - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("Register"), - backgroundColor: Colors.yellow, - automaticallyImplyLeading: false, - ), - body: Center( - child: Column( - children: [ - RaisedButton( - child: Text('Back'), - onPressed: (){ - Navigator.pushNamed(context, '/'); + TextButton( + onPressed: () async{ + //final name = _names.text; + final payment = _payment.value; + final date = _date.text; + final notifications = _notifications.selection; + final split = _split.selection; }, + child: const Text( + "Create Group"), + ), - RaisedButton( - child: Text('register'), - onPressed: (){ - Navigator.pushNamed(context, '/homepage'); - }, - ) ], ), ), ); - } -} + };