-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from rusiruavb/master
Implement credit card form
- Loading branch information
Showing
51 changed files
with
4,631 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
const RootURLPath = 'http://10.0.2.2:4000'; | ||
const GET_SEARCHED_DOCTORS = '$RootURLPath/doctor/search'; | ||
const CREATE_USER_ACCOUNT = '$RootURLPath/user/create'; | ||
const LOGIN_USER_ACCOUNT = '$RootURLPath/user/login'; | ||
const GET_USER_PROFILE = '$RootURLPath/user/'; | ||
const CREATE_APPOINTMENT = '$RootURLPath/appointment/create'; | ||
const GET_APPOINTMENTS = '$RootURLPath/appointment/'; | ||
const CREATE_REFUND_REQUEST = '$RootURLPath/refund/create'; | ||
const GET_REFUND_REQUESTS = '$RootURLPath/refund/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import 'package:dialog_doc990_mobile/constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class GenderDropdown extends StatefulWidget { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
final String value; | ||
|
||
const GenderDropdown({ | ||
Key key, | ||
this.isRequiredFeild, | ||
this.onChange, | ||
this.text, | ||
this.value, | ||
}) : super(key: key); | ||
|
||
@override | ||
_GenderDropdownState createState() => _GenderDropdownState( | ||
isRequiredFeild: isRequiredFeild, | ||
onChange: onChange, | ||
text: text, | ||
value: value, | ||
); | ||
} | ||
|
||
class _GenderDropdownState extends State<GenderDropdown> { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final bool isRequiredFeild; | ||
final String value; | ||
bool _isFieldValid; | ||
|
||
_GenderDropdownState({ | ||
Key key, | ||
this.isRequiredFeild, | ||
this.onChange, | ||
this.text, | ||
this.value, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
return Container( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
text, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 15, | ||
), | ||
textAlign: TextAlign.left, | ||
), | ||
SizedBox( | ||
height: size.height * 0.005, | ||
), | ||
DropDownContainer( | ||
child: DropdownButtonFormField<String>( | ||
validator: (value) { | ||
if (value == null) { | ||
value = ''; | ||
} | ||
if (value.isEmpty) { | ||
setState(() { | ||
_isFieldValid = false; | ||
}); | ||
return null; | ||
} else { | ||
setState(() { | ||
_isFieldValid = true; | ||
}); | ||
return null; | ||
} | ||
}, | ||
items: gender | ||
.map( | ||
(item) => DropdownMenuItem( | ||
child: Text( | ||
item, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 18, | ||
), | ||
), | ||
value: item, | ||
), | ||
) | ||
.toList(), | ||
hint: Text( | ||
'Select your gender', | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 18, | ||
fontWeight: FontWeight.w500, | ||
color: Colors.grey[600], | ||
), | ||
), | ||
decoration: InputDecoration( | ||
border: InputBorder.none, | ||
), | ||
onChanged: onChange, | ||
)), | ||
isRequiredFeild != null && | ||
isRequiredFeild && | ||
_isFieldValid != null && | ||
!_isFieldValid | ||
? Padding( | ||
padding: EdgeInsets.only(left: 5), | ||
child: Text( | ||
text + ' is required!', | ||
style: TextStyle( | ||
color: Colors.red[800], | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 14, | ||
), | ||
), | ||
) | ||
: Text(''), | ||
SizedBox( | ||
height: size.height * 0.010, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class DropDownContainer extends StatelessWidget { | ||
final Widget child; | ||
|
||
const DropDownContainer({ | ||
Key key, | ||
this.child, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
|
||
return Container( | ||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 3), | ||
width: size.width * 0.9, | ||
height: 50, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], borderRadius: BorderRadius.circular(8)), | ||
child: child, | ||
); | ||
} | ||
} | ||
|
||
List<String> gender = [ | ||
'🧔 Male', | ||
'👩 Female', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
lib/components/payment_input_fields/card_expire_field.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import 'package:dialog_doc990_mobile/constants.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_multi_formatter/flutter_multi_formatter.dart'; | ||
|
||
class CardExpireDateField extends StatefulWidget { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final IconData icon; | ||
final String value; | ||
final bool isRequiredFeild; | ||
const CardExpireDateField({ | ||
Key key, | ||
this.onChange, | ||
this.icon, | ||
this.value, | ||
this.text, | ||
this.isRequiredFeild, | ||
}) : super(key: key); | ||
@override | ||
_CardExpireDateFieldState createState() => _CardExpireDateFieldState( | ||
icon: icon, | ||
onChange: onChange, | ||
text: text, | ||
value: value, | ||
isRequiredFeild: isRequiredFeild, | ||
); | ||
} | ||
|
||
class _CardExpireDateFieldState extends State<CardExpireDateField> { | ||
final ValueChanged<String> onChange; | ||
final String text; | ||
final bool isNumber; | ||
final String value; | ||
final IconData icon; | ||
final bool isRequiredFeild; | ||
bool _isFieldValid; | ||
bool _isObscure = true; | ||
_CardExpireDateFieldState({ | ||
Key key, | ||
this.onChange, | ||
this.isNumber, | ||
this.icon, | ||
this.value, | ||
this.text, | ||
this.isRequiredFeild, | ||
}); | ||
@override | ||
Widget build(BuildContext context) { | ||
final size = MediaQuery.of(context).size; | ||
return Container( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
text, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 15, | ||
fontWeight: FontWeight.w600, | ||
), | ||
textAlign: TextAlign.left, | ||
), | ||
SizedBox( | ||
height: size.height * 0.005, | ||
), | ||
TextFieldContainer( | ||
child: TextFormField( | ||
validator: (value) { | ||
if (value.isEmpty) { | ||
setState(() { | ||
_isFieldValid = false; | ||
}); | ||
return null; | ||
} else { | ||
setState(() { | ||
_isFieldValid = true; | ||
}); | ||
return null; | ||
} | ||
}, | ||
keyboardType: TextInputType.number, | ||
decoration: InputDecoration( | ||
border: InputBorder.none, | ||
hintText: value, | ||
), | ||
onChanged: onChange, | ||
style: TextStyle( | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 18, | ||
fontWeight: FontWeight.w500, | ||
color: Colors.grey[800], | ||
), | ||
inputFormatters: [CreditCardExpirationDateFormatter()], | ||
), | ||
), | ||
isRequiredFeild != null && | ||
isRequiredFeild && | ||
_isFieldValid != null && | ||
!_isFieldValid | ||
? Padding( | ||
padding: EdgeInsets.only(left: 5), | ||
child: Text( | ||
text + ' is required.', | ||
style: TextStyle( | ||
color: Colors.red[800], | ||
fontFamily: FONT_FAMILY_PRIMARY, | ||
fontSize: 12, | ||
), | ||
), | ||
) | ||
: Text(''), | ||
SizedBox( | ||
height: size.height * 0.010, | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class TextFieldContainer extends StatelessWidget { | ||
final Widget child; | ||
const TextFieldContainer({Key key, this.child}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Size size = MediaQuery.of(context).size; | ||
return Container( | ||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 1.5), | ||
width: size.width * 0.9, | ||
height: 50, | ||
decoration: BoxDecoration( | ||
color: Colors.grey[300], borderRadius: BorderRadius.circular(8)), | ||
child: child, | ||
); | ||
} | ||
} |
Oops, something went wrong.