Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# login_ui
# RECORD KEEPER

A new Flutter application.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
A flutter application which contains all our money records.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.login_ui"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="login_ui"
android:label="Record Keeper"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
4 changes: 3 additions & 1 deletion lib/config/database_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DatabaseHelper {
static final columnAmount = 'amount';
static final columnCondition = 'condition';
static final columnDescription = 'description';
static final columnIcon = 'icon';

//making it a singleton class
DatabaseHelper._privateConstructor();
Expand Down Expand Up @@ -49,7 +50,8 @@ class DatabaseHelper {
$columnPhone TEXT,
$columnAmount INTEGER,
$columnCondition TEXT,
$columnDescription TEXT
$columnDescription TEXT,
$columnIcon INTEGER
)
'''
);
Expand Down
7 changes: 7 additions & 0 deletions lib/config/icon.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Map<int,String> iconNumber={
0:'🍔',
1:'🛒',
2:'💊',
3:'⚫'
};

4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ Logout() async {
prefs.remove('Number');
prefs.remove('companyName');
exit(0);
}
}


31 changes: 28 additions & 3 deletions lib/screens/auth/SignIn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:login_ui/config/database_helper.dart';
import 'package:login_ui/config/palette.dart';
import 'package:login_ui/main.dart';
import 'package:login_ui/screens/auth/change_password.dart';
import 'package:login_ui/screens/auth/forgotpass_email.dart';
import 'home.dart';

class SignIn extends StatefulWidget {
Expand All @@ -19,7 +21,7 @@ class _SignInState extends State<SignIn> {
bool isLoading = false;
@override
void initState() {
// TODO: implement initState

super.initState();
emailctrl = new TextEditingController();
passctrl = new TextEditingController();
Expand Down Expand Up @@ -91,6 +93,20 @@ class _SignInState extends State<SignIn> {
)),
),
),
InkWell(
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>EnterEmail()));
},
child: Align(
alignment: Alignment.topRight,
child: Text(
'Forgot password',
style: TextStyle(
decoration: TextDecoration.underline
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: Row(
Expand Down Expand Up @@ -131,21 +147,30 @@ class _SignInState extends State<SignIn> {
"pass": passctrl.text,
};
var res = await http.post(url, body: data);
if (jsonDecode(res.body) == "dont have account") {
var body=jsonDecode(res.body);
print(body);
if (body['result'] == "dont have account") {
print("if");
Fluttertoast.showToast(
msg: "Dont have Account, Please register",
toastLength: Toast.LENGTH_LONG);
print("Dont have Account, Please register");
} else {
if (jsonDecode(res.body) == "false") {
print("else");
if (body['result'] =="false") {
Fluttertoast.showToast(
msg: "Incorrect Password", toastLength: Toast.LENGTH_SHORT);
print('Incorrect Password');
} else {
List<Map<String, dynamic>> query =
await DatabaseHelper.instance.queryAll();
int Take = await DatabaseHelper.instance.TotalToTake();
int Give = await DatabaseHelper.instance.TotalToGive();
addEmailToSF(emailctrl.text);
addPassToSF(passctrl.text);
addNameToSF(body['name']);
addCompanyNameToSF(body['company']);
addNumberToSF(body['phone']);
Navigator.push(context,
MaterialPageRoute(builder: (context) => Home(query, Give, Take)));
}
Expand Down
140 changes: 110 additions & 30 deletions lib/screens/auth/add.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:login_ui/config/database_helper.dart';
import 'package:toggle_switch/toggle_switch.dart';
Expand All @@ -18,8 +19,11 @@ class _AddState extends State<Add> {
int _controller2;
TextEditingController _controller3 = new TextEditingController();
TextEditingController _controller4 = new TextEditingController();
bool toggleValue = false;
bool toggleValue = true;
int Take = 0, Give = 0;
List<bool> selected=[false,false,false,false];
int index=0;
int selectedIndex=3;
@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -108,6 +112,39 @@ class _AddState extends State<Add> {
fontSize: 23,
),
),
Row(
children: [
Expanded(
child: SizedBox(
height: 50,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
option('Food',0),
option('Shopping',1),
option('Medical',2),
option('Others',3),
// option('Vacation',4),
// option('Entertainment',5),
// option('',6),
// option('Food',7),
],
),
),
),
InkWell(
child: Icon(Icons.cancel,
),
onTap: (){
setState(() {
clearAll();
selectedIndex=null;
});

},
)
],
),
TextField(
decoration: InputDecoration(fillColor: Colors.white24,
filled: true),
Expand All @@ -131,6 +168,7 @@ class _AddState extends State<Add> {
labels: ['Take', 'Give'],
activeBgColors: [Colors.green, Color(0xfff96060)],
onToggle: (index) {
print(toggleValue);
if(index == 0){
toggleValue = true;
}else{
Expand All @@ -152,35 +190,46 @@ class _AddState extends State<Add> {
Center(
child: InkWell(
onTap: () async {
int i =
await DatabaseHelper.instance.insert({
DatabaseHelper.columnName:
_controller1.text,
DatabaseHelper.columnAmount:
_controller2,
DatabaseHelper.columnPhone:
_controller3.text,
DatabaseHelper.columnCondition:
(toggleValue == false)
? 'Give'
: 'Take',
DatabaseHelper.columnDescription: _controller4.text
});
List<Map<String, dynamic>> query =
await DatabaseHelper.instance
.queryAll();
Take = await DatabaseHelper.instance.TotalToTake();
Give = await DatabaseHelper.instance.TotalToGive();
widget.Take = Take;
widget.Give = Give;
closePopup();
setState(() {
_controller1.text = '';
_controller3.text = '';
_controller2 = 0;
widget.query = query;
toggleValue = false;
});
if(_controller1.text=='')
{
Fluttertoast.showToast(msg: 'Please enter name');
}
else if(_controller2==null)
{
Fluttertoast.showToast(msg: 'Please enter amount');
}
else{
int i =
await DatabaseHelper.instance.insert({
DatabaseHelper.columnName:
_controller1.text,
DatabaseHelper.columnAmount:
_controller2,
DatabaseHelper.columnPhone:
_controller3.text,
DatabaseHelper.columnCondition:
(toggleValue == false)
? 'Give'
: 'Take',
DatabaseHelper.columnDescription: _controller4.text,
DatabaseHelper.columnIcon: selectedIndex
});
List<Map<String, dynamic>> query =
await DatabaseHelper.instance
.queryAll();
Take = await DatabaseHelper.instance.TotalToTake();
Give = await DatabaseHelper.instance.TotalToGive();
widget.Take = Take;
widget.Give = Give;
closePopup();
setState(() {
_controller1.text = '';
_controller3.text = '';
_controller2 = 0;
widget.query = query;
toggleValue = false;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
Expand Down Expand Up @@ -221,6 +270,35 @@ class _AddState extends State<Add> {
)
);
}

Padding option(String label,int index) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ChoiceChip(
label: Text(
label,
style: TextStyle(color: Colors.black),
),
selectedColor: Colors.grey,
selected: selected[index],
onSelected:(value){
setState(() {
clearAll();
selected[index]=!selected[index];
selectedIndex=index;
});
},
),
);
}


void clearAll(){

selected=[false,false,false,false];

}

closePopup() async{
List<Map<String, dynamic>> query =
await DatabaseHelper.instance.queryAll();
Expand All @@ -229,3 +307,5 @@ class _AddState extends State<Add> {
Navigator.push(context, MaterialPageRoute(builder: (context)=> Home(query,Give1,Take1)));
}
}


2 changes: 1 addition & 1 deletion lib/screens/auth/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _AuthScreenState extends State<AuthScreen>

Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: true,
// resizeToAvoidBottomPadding: true,
body: Stack(
children: [
SizedBox.expand(
Expand Down
Loading