Fakultas Ilmu Komputer UI

Commit 3f72840a authored by Fakhira Devina's avatar Fakhira Devina
Browse files

Merge branch 'PBI-3-registrasi_login' into staging

parents 874191e1 b0bb88e2
Pipeline #42412 failed with stages
in 38 minutes and 4 seconds
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-04-20 21:59:20.942979","version":"1.15.17"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.6+3\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.6+3\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+6\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"D:\\\\Flutter\\\\flutter_windows_v1.9.1+hotfix.2-stable\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+4\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-04-21 10:40:51.758556","version":"1.15.17"}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
]>
<svg version="1.1" id="Livello_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 533.5 544.3"
style="enable-background:new 0 0 533.5 544.3;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4285F4;}
.st1{fill:#34A853;}
.st2{fill:#FBBC04;}
.st3{fill:#EA4335;}
</style>
<metadata>
<sfw xmlns="&ns_sfw;">
<slices></slices>
<sliceSourceBounds bottomLeftOrigin="true" height="544.3" width="533.5" x="0.1" y="110.1"></sliceSourceBounds>
</sfw>
</metadata>
<g>
<path class="st0" d="M533.5,278.4c0-18.5-1.5-37.1-4.7-55.3H272.1v104.8h147c-6.1,33.8-25.7,63.7-54.4,82.7v68h87.7
C503.9,431.2,533.5,361.2,533.5,278.4z"/>
<path class="st1" d="M272.1,544.3c73.4,0,135.3-24.1,180.4-65.7l-87.7-68c-24.4,16.6-55.9,26-92.6,26c-71,0-131.2-47.9-152.8-112.3
H28.9v70.1C75.1,486.3,169.2,544.3,272.1,544.3z"/>
<path class="st2" d="M119.3,324.3c-11.4-33.8-11.4-70.4,0-104.2V150H28.9c-38.6,76.9-38.6,167.5,0,244.4L119.3,324.3z"/>
<path class="st3" d="M272.1,107.7c38.8-0.6,76.3,14,104.4,40.8l0,0l77.7-77.7C405,24.6,339.7-0.8,272.1,0C169.2,0,75.1,58,28.9,150
l90.4,70.1C140.8,155.6,201.1,107.7,272.1,107.7z"/>
</g>
</svg>
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/page/login/login.dart';
import 'package:shared_preferences/shared_preferences.dart';
class BisaGoDrawer extends StatelessWidget {
final List<Map<String, dynamic>> drawerList = [
{'title': 'Beranda', 'icon': Icons.home},
{'title': 'Riwayat Pencarian', 'icon': Icons.history},
{'title': 'Tentang Aplikasi', 'icon': Icons.info},
{'title': 'Log out', 'icon': Icons.keyboard_backspace}
{'title': 'Login', 'icon': Icons.keyboard_backspace}
];
@override
......@@ -24,10 +26,14 @@ class BisaGoDrawer extends StatelessWidget {
),
child: Row(
children: <Widget>[
FloatingActionButton(
backgroundColor: Colors.white,
elevation: 0,
onPressed: () => {},
SizedBox(
width: 40,
child: FloatingActionButton(
heroTag: null,
backgroundColor: Colors.white,
elevation: 0,
onPressed: () => {},
),
),
Padding(
padding: EdgeInsets.all(doubleSpace),
......@@ -52,6 +58,7 @@ class BisaGoDrawer extends StatelessWidget {
menus.forEach((menu) {
drawerItem.add(menu);
});
return Theme(
data: Theme.of(context).copyWith(
canvasColor: greenPrimary,
......@@ -63,6 +70,43 @@ class BisaGoDrawer extends StatelessWidget {
}
Widget _createListTile({BuildContext context, IconData icon, String title}) {
if (title == 'Login') {
return Container(
child: FutureBuilder(
future: changeLoginDrawer(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData) {
return Container(
child: ListTile(
leading: Icon(
icon,
color: Colors.white,
size: 30,
),
title: Text(
snapshot.data,
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontFamily: 'Muli',
),
),
onTap: () async {
await checkLoginStatus(context);
},
),
decoration: BoxDecoration(
color: greenPrimary,
border: Border(
bottom: BorderSide(color: Colors.white),
),
),
);
}
return Container();
}),
);
}
return Container(
child: ListTile(
leading: Icon(
......@@ -78,9 +122,7 @@ class BisaGoDrawer extends StatelessWidget {
fontFamily: 'Muli',
),
),
onTap: () {
Navigator.pop(context);
},
onTap: () {},
),
decoration: BoxDecoration(
color: greenPrimary,
......@@ -90,4 +132,29 @@ class BisaGoDrawer extends StatelessWidget {
),
);
}
Future<String> changeLoginDrawer() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getString("token") == null) {
return 'Login';
} else {
return 'Logout';
}
}
checkLoginStatus(BuildContext context) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getString("token") == null) {
_navigateToLoginPage(context);
} else {
print('okeee');
await sharedPreferences.clear();
await Navigator.pushNamed(context, '/');
}
}
void _navigateToLoginPage(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Login());
Navigator.of(context).push(route);
}
}
......@@ -6,4 +6,4 @@ void main() {
ApiFlavor.flavor = BuildFlavor.production.toString();
runApp(BisaGo());
}
\ No newline at end of file
}
import 'dart:convert';
class User {
bool is_login;
String username;
String name;
String email;
String phone_number;
String token;
User({this.is_login, this.username, this.name, this.email, this.phone_number, this.token});
factory User.fromJson(Map<String, dynamic> map) {
return User(
username: map["username"],
name: map["name"],
email: map["email"],
phone_number: map["phone_number"],);
}
Map<String, dynamic> toJson() {
return {"username": username, "name": name, "email": email, "phone_number": phone_number};
}
@override
String toString() {
return 'User{"username": $username, "name": $name, "email": $email, "phone_number": $phone_number}';
}
}
List<User> userFromJson(String jsonData) {
final data = json.decode(jsonData);
return List<User>.from(data.map((item) => User.fromJson(item)));
}
String userToJson(User data) {
final jsonData = data.toJson();
return json.encode(jsonData);
}
\ No newline at end of file
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/page/registrasi/registrasi.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
import 'package:ppl_disabilitas/utils/customTextField.dart';
import 'package:ppl_disabilitas/utils/validator.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
class Login extends StatefulWidget{
LoginState createState() => LoginState();
}
class LoginState extends State<Login> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
SharedPreferences sharedPreferences;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 15,
centerTitle: true,
backgroundColor: greenPrimary,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
"bisaGo",
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),
)
],
),
actions: <Widget>[
Padding(
padding: EdgeInsets.all(doubleSpace),
child: InkWell(
child: Text(
'Daftar',
style: TextStyle(fontSize: 15),
),
onTap: () {
_navigateToRegistrasiPage(context);
},
),
)
],
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Center(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 25),
Text('Masuk ke Akun',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
SizedBox(height: 20),
CustomTextField(
title: 'Nomor Telepon atau Email',
key: Key('Text Field Akun'),
validator: FieldValidator.validateEmail,
controller: emailController,
),
CustomTextField(
title: 'Password',
key: Key('Text Field Password'),
obsecure: true,
validator: FieldValidator.validatePassword,
controller: passwordController,
),
Container(
margin: EdgeInsets.fromLTRB(0, 30, 0, 10),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 40,
child: submitButton(
'Masuk', Color(0xff3A903A), Colors.white,
Color(0xff3A903A), Colors.white, _validateLoginInput),
)
),
Container(
child: separator('Atau masuk dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
alignment: Alignment.center,
child: googleButton(),
),
],
),
),
)
)
)
);
}
void _validateLoginInput() async {
final FormState form = _formKey.currentState;
if(_formKey.currentState.validate()) {
form.save();
login(emailController.text, passwordController.text);
}
}
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
login(String email, String password) async {
Map data = {
'username' : email,
'password' : password
};
sharedPreferences = await SharedPreferences.getInstance();
var response = await http.post('http://poipole-staging.herokuapp.com/api-token-auth/', body: data);
if(response.statusCode == 200) {
print('ok');
Map<String, dynamic> tokenMap = jsonDecode(response.body);
setState(() {
sharedPreferences.setString("token", tokenMap['token']);
sharedPreferences.setString("email", email);
Navigator.pushNamed(context, '/');
});
}
else {
print(response.body);
}
}
void _navigateToRegistrasiPage(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Registrasi());
Navigator.of(context).push(route);
}
}
\ No newline at end of file
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/page/dashboard/dashboard.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
import 'package:ppl_disabilitas/utils/customTextField.dart';
import 'package:ppl_disabilitas/utils/validator.dart';
import 'package:http/http.dart' as http;
class Registrasi extends StatefulWidget {
RegistrasiState createState() => RegistrasiState();
}
class RegistrasiState extends State<Registrasi> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 15,
centerTitle: true,
backgroundColor: greenPrimary,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(padding: EdgeInsets.all(doubleSpace),
child: Text(
"bisaGo",
style: TextStyle(
fontSize: 25,
fontFamily: 'Comfortaa',
fontWeight: FontWeight.w800),
),
)
],
),
actions: <Widget>[
Padding(
padding: EdgeInsets.all(doubleSpace),
child: InkWell(
child: Text(
'Login',
style: TextStyle(fontSize: 15),
),
onTap: () {
Navigator.pop(context);
},
),
)
],
),
body: SingleChildScrollView(
child: Form(
key: _formKey,
child: Center(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 25),
Text('Daftar Akun Baru',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25,
),
),
SizedBox(height: 20),
CustomTextField(
title: 'Nama Lengkap',
key: Key('Text Field Nama'),
validator: FieldValidator.validateName,
controller: nameController,
),
CustomTextField(
title: 'Nomor Telepon',
key: Key('Text Field Nomor Telepon'),
validator: FieldValidator.validatePhoneNumber,
controller: phoneController,
),
CustomTextField(
title: 'Email',
key: Key('Text Field Email'),
controller: emailController,
validator: FieldValidator.validateEmail,
),
CustomTextField(
title: 'Password',
key: Key('Text Field Password'),
obsecure: true,
validator: FieldValidator.validatePassword,
controller: passwordController,
),
CustomTextField(
title: 'Konfirmasi Password',
key: Key('Text Field Konfirmasi Password'),
obsecure: true,
validator: (input) {
if (input != passwordController.text) {
return '*Password tidak sesuai. Coba lagi';
}
return null;
},
),
Container(
margin: EdgeInsets.fromLTRB(0, 30, 0, 10),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 40,
child: submitButton('Daftar', Color(0xff3A903A), Colors.white,
Color(0xff3A903A), Colors.white, _validateLoginInput),
)
),
Container(
child: separator('Atau daftar dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
alignment: Alignment.center,
child: googleButton(),
),
],
),
),
),
),
),
);
}
void _validateLoginInput() async {
final FormState form = _formKey.currentState;
if (_formKey.currentState.validate()) {
form.save();
await createUser(nameController.text.toString(), phoneController.text.toString(),
emailController.text.toString(), passwordController.text.toString());
_showDialog();
}
}
TextEditingController nameController = TextEditingController();
TextEditingController phoneController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
createUser(String name, String phone_number, String email, String password) async {
Map data = {
'name' : name,
'phone_number' : phone_number,
'email' : email,
'password' : password,
};
final response = await http.post(
"http://poipole-staging.herokuapp.com/api/register/",
// headers: {"Content-Type": "application/json"},
body: data,
);
if (response.statusCode == 200) {
} else {
return false;
}
}
void _showDialog() {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Pendaftaran Berhasil"),
content: Text("Silahkan kembali ke halaman utama untuk login"),
actions: <Widget>[
FlatButton(onPressed: () {
_navigateToDashboard(context);
},
child: Text("Dashboard"))
],
);
}
);
}
void _navigateToDashboard(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Dashboard());
Navigator.of(context).push(route);
}
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Widget submitButton(String text, Color splashColor, Color highlightColor,
Color fillColor, Color textColor, void function()) {
return RaisedButton(
padding: EdgeInsets.symmetric(vertical: 15),
highlightElevation: 0.0,
splashColor: splashColor,
highlightColor: highlightColor,
elevation: 0.0,
color: fillColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
),
child: Text(
text,
style: TextStyle(fontSize: 20, color: textColor, fontWeight: FontWeight.bold),
),
onPressed: () => function(),
);
}
Widget separator(String text, double textSize, int textColor, double thickness, int color) {
return Row(
children: <Widget>[
SizedBox(
width: 20,
),