Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 115 additions & 95 deletions main.dart
Original file line number Diff line number Diff line change
@@ -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<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
//
final List<String> 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: <Widget>[
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: <Widget>[
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: <Widget> [
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');
},
)
],
),
),
);
}
}
};