diff --git a/README.md b/README.md index d71bc75..71c7d7f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/android/app/build.gradle b/android/app/build.gradle index 9ded6ba..102e6a0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6a3274e..3c16d68 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ FlutterApplication and put your custom class here. --> iconNumber={ + 0:'🍔', + 1:'🛒', + 2:'💊', + 3:'⚫' +}; + diff --git a/lib/main.dart b/lib/main.dart index dff980f..5b59bfe 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -80,4 +80,6 @@ Logout() async { prefs.remove('Number'); prefs.remove('companyName'); exit(0); -} \ No newline at end of file +} + + diff --git a/lib/screens/auth/SignIn.dart b/lib/screens/auth/SignIn.dart index 013b7cc..66232ec 100644 --- a/lib/screens/auth/SignIn.dart +++ b/lib/screens/auth/SignIn.dart @@ -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 { @@ -19,7 +21,7 @@ class _SignInState extends State { bool isLoading = false; @override void initState() { - // TODO: implement initState + super.initState(); emailctrl = new TextEditingController(); passctrl = new TextEditingController(); @@ -91,6 +93,20 @@ class _SignInState extends State { )), ), ), + 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( @@ -131,14 +147,20 @@ class _SignInState extends State { "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> query = await DatabaseHelper.instance.queryAll(); @@ -146,6 +168,9 @@ class _SignInState extends State { 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))); } diff --git a/lib/screens/auth/add.dart b/lib/screens/auth/add.dart index 9528438..2e17612 100644 --- a/lib/screens/auth/add.dart +++ b/lib/screens/auth/add.dart @@ -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'; @@ -18,8 +19,11 @@ class _AddState extends State { int _controller2; TextEditingController _controller3 = new TextEditingController(); TextEditingController _controller4 = new TextEditingController(); - bool toggleValue = false; + bool toggleValue = true; int Take = 0, Give = 0; + List selected=[false,false,false,false]; + int index=0; + int selectedIndex=3; @override Widget build(BuildContext context) { return Scaffold( @@ -108,6 +112,39 @@ class _AddState extends State { 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), @@ -131,6 +168,7 @@ class _AddState extends State { labels: ['Take', 'Give'], activeBgColors: [Colors.green, Color(0xfff96060)], onToggle: (index) { + print(toggleValue); if(index == 0){ toggleValue = true; }else{ @@ -152,35 +190,46 @@ class _AddState extends State { 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> 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> 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( @@ -221,6 +270,35 @@ class _AddState extends State { ) ); } + + 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> query = await DatabaseHelper.instance.queryAll(); @@ -229,3 +307,5 @@ class _AddState extends State { Navigator.push(context, MaterialPageRoute(builder: (context)=> Home(query,Give1,Take1))); } } + + diff --git a/lib/screens/auth/auth.dart b/lib/screens/auth/auth.dart index 060e806..6e28475 100644 --- a/lib/screens/auth/auth.dart +++ b/lib/screens/auth/auth.dart @@ -31,7 +31,7 @@ class _AuthScreenState extends State Widget build(BuildContext context) { return Scaffold( - resizeToAvoidBottomPadding: true, + // resizeToAvoidBottomPadding: true, body: Stack( children: [ SizedBox.expand( diff --git a/lib/screens/auth/change_password.dart b/lib/screens/auth/change_password.dart new file mode 100644 index 0000000..a3218a8 --- /dev/null +++ b/lib/screens/auth/change_password.dart @@ -0,0 +1,220 @@ +import 'package:flutter/material.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:login_ui/config/palette.dart'; +import 'package:login_ui/screens/auth/change_password.dart'; +import '../../main.dart'; +import '../background_paint.dart'; +import 'home.dart'; +import 'change_password.dart'; +import 'package:http/http.dart'as http; +import 'dart:convert'; + +class ChangePass extends StatefulWidget { + String email; + bool forgot; + ChangePass({this.email,this.forgot}); + @override + _ChangePassState createState() => _ChangePassState(); +} + +class _ChangePassState extends State with SingleTickerProviderStateMixin { + + AnimationController _controller; + TextEditingController passctrl,cpassctrl; + String cpass_; + bool pass = true,cpass=true; + bool isLoading = false; + @override + void initState() { + _controller = + AnimationController(vsync: this, duration: Duration(seconds: 4)); + passctrl = new TextEditingController(); + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: Stack(children: [ + SizedBox.expand( + child: CustomPaint( + painter: BackgroundPainter( + animation: _controller.view, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(32), + child: Column( + children: [ + Expanded( + flex: 4, + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'Enter new Password', + style: TextStyle( + color: Colors.white, + fontSize: 30, + fontWeight: FontWeight.w500), + ), + ), + ), + Expanded( + flex: 5, + child: ListView( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16), + child: TextField( + controller: passctrl, + + obscureText: pass, + decoration: InputDecoration( + hintText: 'New Password', + hintStyle: TextStyle(color: Colors.black54, fontSize: 20), + prefixIcon: Icon( + Icons.vpn_key, + color: Colors.black54, + size: 25, + ), + suffixIcon: IconButton( + onPressed: () { + setState(() { + pass = !pass; + }); + }, + icon: Icon( + Icons.remove_red_eye, + color: Colors.black, + size: 25, + ), + )), + ), + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 16), + child: TextField( + // controller: cpassctrl, + onChanged: (val){ + cpass_=val; + }, + obscureText: cpass, + decoration: InputDecoration( + hintText: 'Confirm New Password', + hintStyle: TextStyle(color: Colors.black54, fontSize: 20), + prefixIcon: Icon( + Icons.vpn_key, + color: Colors.black54, + size: 25, + ), + suffixIcon: IconButton( + onPressed: () { + setState(() { + cpass = !cpass; + }); + }, + icon: Icon( + Icons.remove_red_eye, + color: Colors.black, + size: 25, + ), + )), + ), + ), + + Center( + child: InkWell( + onTap: () async { + String message=""; + bool result; + if(passctrl.text.length<6) + setState(() { + message="Enter the password(max 6)"; + }); + else if(cpass_==null) + setState(() { + message="Please confirm new password"; + }); + else if(cpass_!=passctrl.text){ + setState(() { + message="Password should match"; + }); + + } + else{ + result = await UpdateUserTable(); + setState(() { + if(result){ + message="Password updated successfull"; + addPassToSF(cpass_); + } + + else + message="Something Went Wrong, try again"; + }); + } + Fluttertoast.showToast(msg: message,toastLength: Toast.LENGTH_SHORT ); + if(result){ + Navigator.pop(context); + Navigator.pop(context); + if(widget.forgot==null) + Navigator.pop(context); + } + + // (namectrl == null) ? addNameToSF(widget.name) : addNameToSF(namectrl); + // (number == null) ? addNumberToSF(widget.number) : addNumberToSF(number); + // (companyname == null) ? addCompanyNameToSF(widget.companyname) : addCompanyNameToSF(companyname); + // name1 = await getName(); + // email1 = await getEmail(); + // companyname1 = await getCompanyName(); + // number1 = await getNumber(); + // bool result = await UpdateUserTable(); + // result ? Fluttertoast.showToast(msg: 'Changes saved successfully',toastLength: Toast.LENGTH_SHORT,gravity: ToastGravity.CENTER ): Fluttertoast.showToast(msg: 'Something Went Wrong, try again',toastLength: Toast.LENGTH_SHORT,gravity: ToastGravity.CENTER ); + + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 85, vertical: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8)), + color: Color(0xfff96060), + ), + child: Text('Change Password', + style: TextStyle(fontSize: 18, color: Colors.white), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ]), + ); + + } + Future UpdateUserTable()async { + var url = "https://355668.xyz/Authentication/forgot_pass.php"; + String email=await getEmail(); + var data = { + "email" : widget.email??email, + "pass":cpass_ + }; + var res = await http.post(url, body: data); + if(jsonDecode(res.body) == "true"){ + return true; + }else{ + return false; + } + } +} \ No newline at end of file diff --git a/lib/screens/auth/edit.dart b/lib/screens/auth/edit.dart index f421c1f..c9894ff 100644 --- a/lib/screens/auth/edit.dart +++ b/lib/screens/auth/edit.dart @@ -8,8 +8,8 @@ class Edit extends StatefulWidget { String Name; int id; String number,desc; - int Amount; - Edit(this.id,this.Name, this.Amount,this.number,this.desc); + int Amount,icon; + Edit(this.id,this.Name, this.Amount,this.number,this.desc,this.icon); @override _EditState createState() => _EditState(); } @@ -17,10 +17,17 @@ class Edit extends StatefulWidget { class _EditState extends State { String _controller1,_controller3,_controller4; int amount,_controller2=0; + List selected=[false,false,false,false,false,false,false,false]; + + String label='food'; + int index=0; + int selectedIndex; @override void initState() { amount = widget.Amount; - setState((){}); + setState((){ + selected[widget.icon]=true; + }); super.initState(); } @override @@ -103,6 +110,7 @@ class _EditState extends State { _controller3 = value; }, ), + Text( 'Description', style: TextStyle( @@ -111,6 +119,39 @@ class _EditState extends State { ), ), SizedBox(height: 12,), + 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; + }); + + }, + ) + ], + ), TextFormField( initialValue: widget.desc, onChanged: (value){ @@ -133,6 +174,7 @@ class _EditState extends State { DatabaseHelper.columnAmount: (_controller2 == 0)? widget.Amount : _controller2, DatabaseHelper.columnPhone: (_controller3 == null) ? widget.number : _controller3, DatabaseHelper.columnDescription: (_controller4 == null) ? widget.desc : _controller4, + DatabaseHelper.columnIcon: (selectedIndex==null) ? widget.icon : selectedIndex }); List> query = await DatabaseHelper.instance.queryAll(); int Take = await DatabaseHelper.instance.TotalToTake(); @@ -190,4 +232,32 @@ class _EditState extends State { ), ); } + + 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,false,false,false,false]; + + } } diff --git a/lib/screens/auth/forgotpass_email.dart b/lib/screens/auth/forgotpass_email.dart new file mode 100644 index 0000000..ac42683 --- /dev/null +++ b/lib/screens/auth/forgotpass_email.dart @@ -0,0 +1,208 @@ +import 'dart:isolate'; + +import 'package:flutter/material.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:login_ui/config/palette.dart'; +import 'package:login_ui/screens/auth/change_password.dart'; +import '../../main.dart'; +import '../background_paint.dart'; +import 'home.dart'; +import 'change_password.dart'; +import 'package:http/http.dart'as http; +import 'dart:convert'; + +class EnterEmail extends StatefulWidget { + + @override + _EnterEmailState createState() => _EnterEmailState(); +} + +class _EnterEmailState extends State with SingleTickerProviderStateMixin { + + AnimationController _controller; + bool isLoading = false; + String email='',sec_ans=''; + @override + void initState() { + _controller = + AnimationController(vsync: this, duration: Duration(seconds: 4)); + + super.initState(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + @override + Widget build(BuildContext context) { + return Scaffold( + resizeToAvoidBottomInset: false, + body: Stack(children: [ + SizedBox.expand( + child: CustomPaint( + painter: BackgroundPainter( + animation: _controller.view, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(32), + child: Column( + children: [ + Expanded( + flex: 4, + child: Align( + alignment: Alignment.centerLeft, + child: Text( + 'Forgot Password', + style: TextStyle( + color: Colors.white, + fontSize: 30, + fontWeight: FontWeight.w500), + ), + ), + ), + Expanded( + flex: 5, + child: ListView( + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 16), + child: TextField( + onChanged: (value){ + email=value; + }, + decoration: InputDecoration( + hintText: 'Enter email', + hintStyle: TextStyle(color: Colors.black54, fontSize: 20), + prefixIcon: Icon( + Icons.email, + color: Colors.black54, + size: 25, + ), + ), + ), + ), + + Padding( + padding: const EdgeInsets.symmetric(vertical: 16.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Change Password', + style: const TextStyle( + fontWeight: FontWeight.w800, + color: Palette.darkBlue, + fontSize: 24, + ), + ), + Expanded( + child: Center( + child: _LoadingIndicator(isLoading), + ), + ), + _RoundContinueButton(isLoading), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ]), + ); + } + + // void verify() async{ + // setState((){ + // isLoading = true; + // }); + // String pass = await getPass(); + // if(passctrl.text == pass){ + // List> query = + // await DatabaseHelper.instance.queryAll(); + // int Take = await DatabaseHelper.instance.TotalToTake(); + // int Give = await DatabaseHelper.instance.TotalToGive(); + // widget.changePass?Navigator.push(context, MaterialPageRoute(builder: (context)=>ChangePass())):Navigator.push(context, + // MaterialPageRoute(builder: (context) => Home(query, Give, Take))); + + // }else{ + // Fluttertoast.showToast(msg: 'Incorrect Password',toastLength: Toast.LENGTH_LONG); + // } + // setState((){ + // isLoading = false; + // }); + // } + + Widget _RoundContinueButton(isLoading) { + return RawMaterialButton( + onPressed: ()async{ + + if(email=='') + { + Fluttertoast.showToast(msg: 'Please Enter Your Email',toastLength: Toast.LENGTH_LONG); + } + else{ + print("yes"); + checkEmail(); + + } + + + }, + // onPressed: () => (passctrl.text == '') ? Fluttertoast.showToast(msg: 'Please Enter Your password',toastLength: Toast.LENGTH_LONG) : verify(), + elevation: 0.0, + fillColor: Palette.darkBlue, + splashColor: Palette.darkOrange, + padding: const EdgeInsets.all(22.0), + shape: const CircleBorder(), + child: const Icon( + FontAwesomeIcons.longArrowAltRight, + color: Colors.white, + size: 24.0, + ), + ); + } + void checkEmail() async{ + setState(() { + isLoading = true; + }); + var url = "https://355668.xyz/Authentication/forgot_pass_email.php"; + var data = { + "email": email, + // "sec_ans":sec_ans + + }; + var res = await http.post(url, body: data); + var body=jsonDecode(res.body); + print(body); + if(body['result'] == "dont have account") + Fluttertoast.showToast(msg: 'No account Please Register',toastLength: Toast.LENGTH_LONG); + else{ + Navigator.push(context, MaterialPageRoute(builder: (context)=>ChangePass(email: email,forgot: true,))); + } + + setState(() { + isLoading = false; + }); + } + + Widget _LoadingIndicator(bool isLoading) { + return ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 100), + child: Visibility( + visible: isLoading, + child: const LinearProgressIndicator( + backgroundColor: Palette.darkBlue, + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/auth/home.dart b/lib/screens/auth/home.dart index 4628ed4..126b254 100644 --- a/lib/screens/auth/home.dart +++ b/lib/screens/auth/home.dart @@ -9,6 +9,7 @@ import 'package:share/share.dart'; import 'add.dart'; import 'edit.dart'; import 'more.dart'; +import '../../config/icon.dart'; class Home extends StatefulWidget { List> query; @@ -166,7 +167,8 @@ class _HomeState extends State { widget.query[index]['_id'], widget.query[index]['number'], widget.query[index]['condition'], - widget.query[index]['description']); + widget.query[index]['description'], + widget.query[index]['icon']); }), ), ), @@ -302,7 +304,7 @@ class _HomeState extends State { } Slidable taskWidget(Color color, String name, int amount, int id, - String number, String condition, String desc) { + String number, String condition, String desc, int icon) { return Slidable( actionPane: SlidableDrawerActionPane(), actionExtentRatio: 0.3, @@ -339,7 +341,7 @@ class _HomeState extends State { ), ), Text( - '$condition ₹$amount', + '${iconNumber[(icon)]} $condition ₹$amount', style: TextStyle(color: Colors.grey, fontSize: 18), ) ], @@ -365,7 +367,7 @@ class _HomeState extends State { context, MaterialPageRoute( builder: (context) => - Edit(id, name, amount, number, desc))); + Edit(id, name, amount, number, desc, icon))); }, ), IconSlideAction( @@ -429,11 +431,11 @@ class _HomeState extends State { icon: Icons.share, onTap: () { if (condition == 'Take') { - Navigator.push(context, MaterialPageRoute(builder: (context)=> Reminder('! Reminder ! \n$name you have to Give me ₹$amount Rupees for $desc.'))); + Navigator.push(context, MaterialPageRoute(builder: (context)=> Reminder('! Reminder ! \n$name you have to Give me ₹$amount Rupees for $desc.',false))); // Share.share( // "! *Reminder* ! \n$name you have to Give me ₹$amount Rupees"); } else { - Navigator.push(context, MaterialPageRoute(builder: (context)=> Reminder('! Reminder ! \n$name you have to Take Rupees ₹$amount from me which you had Paid for $desc.'))); + Navigator.push(context, MaterialPageRoute(builder: (context)=> Reminder('! Reminder ! \n$name you have to Take Rupees ₹$amount from me which you had Paid for $desc.',false))); // Share.share( // "! *Reminder* ! \n$name you have to Take Rupees ₹$amount from me"); } diff --git a/lib/screens/auth/more.dart b/lib/screens/auth/more.dart index fa98859..768e101 100644 --- a/lib/screens/auth/more.dart +++ b/lib/screens/auth/more.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:login_ui/screens/auth/profile.dart'; +import 'package:login_ui/screens/auth/share.dart'; import '../../main.dart'; import 'about_us.dart'; +import 'settings.dart'; class More extends StatefulWidget { @@ -34,7 +36,7 @@ class _MoreState extends State { String companyname = await getCompanyName(); int number = await getNumber(); Navigator.push(context, MaterialPageRoute(builder: (context)=>Profile(Name,email,number,companyname)));},child: Bar(Icons.person, 'Profile')), -// GestureDetector(onTap: (){Navigator.push(context, MaterialPageRoute(builder: (context) => Setting()));},child: Bar(Icons.settings, 'Settings')), + GestureDetector(onTap: (){Navigator.push(context, MaterialPageRoute(builder: (context) => Setting()));},child: Bar(Icons.settings, 'Settings')), GestureDetector( onTap: (){ setState(() { @@ -48,7 +50,15 @@ class _MoreState extends State { }, child: Bar(Icons.info_outline, 'About Us')), Bar(Icons.help_outline, 'Help & Support'), - Bar(Icons.share, 'Invite Friends'), + GestureDetector( + child: Bar( + Icons.share, 'Invite Friends' + ), + onTap:(){ + Navigator.push(context, MaterialPageRoute(builder: (context)=> Reminder('Hey check out this app!!',true))); + + }, + ), SizedBox(height: 20,), Center(child: Text('V 1.0.0',style: TextStyle(color: Colors.grey,fontSize:13),),), SizedBox(height: 10,), diff --git a/lib/screens/auth/pin.dart b/lib/screens/auth/pin.dart index 5e5d360..7a36d30 100644 --- a/lib/screens/auth/pin.dart +++ b/lib/screens/auth/pin.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:local_auth/local_auth.dart'; // ignore: unused_import import 'package:login_ui/config/database_helper.dart'; @@ -38,12 +39,13 @@ class _PinState extends State with SingleTickerProviderStateMixin { return GestureDetector( onTap: ()async{ bool check = await bioAuth(); + // bool check = false; List> query = await DatabaseHelper.instance.queryAll(); int Take = await DatabaseHelper.instance.TotalToTake(); int Give = await DatabaseHelper.instance.TotalToGive(); String name = await getName(); setState(() { - check ? Navigator.push(context, MaterialPageRoute(builder: (context) => Home(query,Give,Take))) : Navigator.push(context, MaterialPageRoute(builder: (context) => SharedAuth(name))); + check ? Navigator.push(context, MaterialPageRoute(builder: (context) => Home(query,Give,Take))) : Navigator.push(context, MaterialPageRoute(builder: (context) => SharedAuth(name,false))); }); }, child: Scaffold( @@ -113,6 +115,7 @@ class _PinState extends State with SingleTickerProviderStateMixin { List list = List(); try { list = await localAuthentication.getAvailableBiometrics(); + print("no..."+list[0].toString()); bool auth = false; if (list.length > 0) { if (list.contains(BiometricType.fingerprint)) { @@ -143,7 +146,12 @@ class _PinState extends State with SingleTickerProviderStateMixin { return false; } } catch (e) { - print(e.toString()); + print("------------"+e.toString()); + return false; + Fluttertoast.showToast( + msg: 'Please add a Bio-metric lock', + toastLength: Toast.LENGTH_LONG + ); } } } diff --git a/lib/screens/auth/profile.dart b/lib/screens/auth/profile.dart index ad00533..8fdcd47 100644 --- a/lib/screens/auth/profile.dart +++ b/lib/screens/auth/profile.dart @@ -42,7 +42,7 @@ class _ProfileState extends State { children: [ CircleAvatar( child: Text( - 'AC', style: TextStyle(color: Colors.white, fontSize: 25),), + widget.email[0].toUpperCase(), style: TextStyle(color: Colors.white, fontSize: 30,fontWeight: FontWeight.bold),), backgroundColor: Color(0xfff96060), radius: 50, ), diff --git a/lib/screens/auth/register.dart b/lib/screens/auth/register.dart index 407d0a1..26719df 100644 --- a/lib/screens/auth/register.dart +++ b/lib/screens/auth/register.dart @@ -153,11 +153,13 @@ class _RegisterState extends State { var res = await http.post(url, body: data); if (jsonDecode(res.body) == "Account already exists") { + print('Account already exists, Please login'); Fluttertoast.showToast( msg: 'Account already exists, Please login', toastLength: Toast.LENGTH_LONG); } else { if (jsonDecode(res.body) == "true") { + print('Account Created'); Fluttertoast.showToast( msg: "Account Created", toastLength: Toast.LENGTH_SHORT); List> query = @@ -181,7 +183,9 @@ class _RegisterState extends State { Widget _RoundContinueButton(isLoading) { return RawMaterialButton( - onPressed: () => (namectrl.text == '' || emailctrl.text == '' || passctrl.text == '') ? Fluttertoast.showToast(msg: 'Please Enter Name, Email And password',toastLength: Toast.LENGTH_LONG) : registerUser(), + onPressed: () { + (namectrl.text == '' || emailctrl.text == '' || passctrl.text == '') ? print('not done') : registerUser(); + }, elevation: 0.0, fillColor: Palette.darkBlue, splashColor: Palette.darkOrange, diff --git a/lib/screens/auth/settings.dart b/lib/screens/auth/settings.dart index 8cb4786..66d13eb 100644 --- a/lib/screens/auth/settings.dart +++ b/lib/screens/auth/settings.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:login_ui/screens/auth/shared_auth.dart'; import '../../main.dart'; @@ -23,7 +24,16 @@ class _SettingState extends State { ), body: Column( children: [ - Bar(Icons.person, 'Change Password'), + GestureDetector( + onTap: ()async{ + String name = await getName(); + Navigator.push(context, MaterialPageRoute(builder: (context) => SharedAuth(name, true))); + }, + child: Bar( + Icons.person, + 'Change Password' + ) + ), GestureDetector( onTap: (){ setState(() { diff --git a/lib/screens/auth/share.dart b/lib/screens/auth/share.dart index 4dd2a98..4029ccc 100644 --- a/lib/screens/auth/share.dart +++ b/lib/screens/auth/share.dart @@ -3,7 +3,8 @@ import 'package:share/share.dart'; class Reminder extends StatefulWidget { String defaultMsg; - Reminder(this.defaultMsg); + bool invite; + Reminder(this.defaultMsg,this.invite); @override _ReminderState createState() => _ReminderState(); } @@ -29,7 +30,7 @@ class _ReminderState extends State { children: [ SizedBox(height: 20,), Text( - 'Customize your Message', + widget.invite?'Invite a friend':'Customize your Message', style: TextStyle( color: Colors.black, fontSize: 23, diff --git a/lib/screens/auth/shared_auth.dart b/lib/screens/auth/shared_auth.dart index 009be7f..57deca1 100644 --- a/lib/screens/auth/shared_auth.dart +++ b/lib/screens/auth/shared_auth.dart @@ -3,13 +3,16 @@ import 'package:fluttertoast/fluttertoast.dart'; 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/screens/auth/change_password.dart'; import '../../main.dart'; import '../background_paint.dart'; import 'home.dart'; +import 'change_password.dart'; class SharedAuth extends StatefulWidget { String name; - SharedAuth(this.name); + bool changePass; + SharedAuth(this.name,this.changePass); @override _SharedAuthState createState() => _SharedAuthState(); } @@ -73,7 +76,7 @@ class _SharedAuthState extends State controller: passctrl, obscureText: pass, decoration: InputDecoration( - hintText: 'Password', + hintText: widget.changePass?'Current Password':'Password', hintStyle: TextStyle(color: Colors.black54, fontSize: 20), prefixIcon: Icon( Icons.vpn_key, @@ -100,7 +103,7 @@ class _SharedAuthState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - 'Verify', + widget.changePass?'Change Password':'Log In', style: const TextStyle( fontWeight: FontWeight.w800, color: Palette.darkBlue, @@ -136,8 +139,9 @@ class _SharedAuthState extends State await DatabaseHelper.instance.queryAll(); int Take = await DatabaseHelper.instance.TotalToTake(); int Give = await DatabaseHelper.instance.TotalToGive(); - Navigator.push(context, + widget.changePass?Navigator.push(context, MaterialPageRoute(builder: (context)=>ChangePass())):Navigator.push(context, MaterialPageRoute(builder: (context) => Home(query, Give, Take))); + }else{ Fluttertoast.showToast(msg: 'Incorrect Password',toastLength: Toast.LENGTH_LONG); } @@ -148,7 +152,7 @@ class _SharedAuthState extends State Widget _RoundContinueButton(isLoading) { return RawMaterialButton( - onPressed: () => (passctrl.text == '') ? Fluttertoast.showToast(msg: 'Please Enter Your password',toastLength: Toast.LENGTH_LONG) : verify(), + onPressed: () => (passctrl.text == '') ? Fluttertoast.showToast(msg: 'Please Enter Your password',toastLength: Toast.LENGTH_LONG) : verify(), elevation: 0.0, fillColor: Palette.darkBlue, splashColor: Palette.darkOrange, diff --git a/pubspec.lock b/pubspec.lock index 004c4a4..09dab88 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.8.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.3.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0" connectivity: dependency: "direct main" description: @@ -84,21 +84,21 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.1.2" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "5.2.1" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -110,7 +110,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "1.0.11" + version: "2.0.5" flutter_slidable: dependency: "direct main" description: @@ -141,14 +141,14 @@ packages: name: fluttertoast url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "8.0.8" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "8.11.0" + version: "8.12.0" http: dependency: "direct main" description: @@ -169,49 +169,56 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" local_auth: dependency: "direct main" description: name: local_auth url: "https://pub.dartlang.org" source: hosted - version: "0.6.3+4" + version: "1.1.8" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.7.0" mime: dependency: transitive description: name: mime url: "https://pub.dartlang.org" source: hosted - version: "0.9.7" + version: "1.0.1" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.27" + version: "1.6.28" path_provider_linux: dependency: transitive description: @@ -239,21 +246,21 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "0.0.5" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.11.1" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "2.2.1" + version: "3.0.2" plugin_platform_interface: dependency: transitive description: @@ -267,14 +274,14 @@ packages: name: process url: "https://pub.dartlang.org" source: hosted - version: "3.0.13" + version: "4.2.4" share: dependency: "direct main" description: name: share url: "https://pub.dartlang.org" source: hosted - version: "0.6.5+4" + version: "2.0.4" shared_preferences: dependency: "direct main" description: @@ -328,7 +335,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.1" splashscreen: dependency: "direct main" description: @@ -342,35 +349,35 @@ packages: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "1.3.1+2" + version: "1.3.2+4" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "1.0.3+1" + version: "1.0.3+3" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" synchronized: dependency: transitive description: @@ -384,56 +391,56 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.4.2" toggle_switch: dependency: "direct main" description: name: toggle_switch url: "https://pub.dartlang.org" source: hosted - version: "0.1.8" + version: "0.1.9" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" webview_flutter: dependency: "direct main" description: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "0.3.24" + version: "2.0.14" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.3.1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.1.2" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.12.13+hotfix.5 <2.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 92e7ba5..2ed0b85 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,7 +34,7 @@ dependencies: path_provider: ^1.6.18 sqflite: ^1.3.1+1 http: ^0.12.0+4 - fluttertoast: ^4.0.1 + fluttertoast: ^8.0.8 shared_preferences: ^0.5.12+4 share: any webview_flutter: