Fakultas Ilmu Komputer UI

Commit 067f6980 authored by Usman Sidiq's avatar Usman Sidiq
Browse files

[REFACTOR] Make page to navigate to login and register

parent 7be2e4fc
Pipeline #34182 passed with stages
in 10 minutes and 15 seconds
import 'package:flutter/material.dart';
import 'flavor/flavor.dart';
import 'page/login/login.dart';
import 'page/registrasi/registrasi.dart';
import 'page/login/landing.dart';
void main() {
ApiFlavor.flavor = BuildFlavor.production.toString();
......@@ -91,12 +90,8 @@ class _MyHomePageState extends State<MyHomePage> {
'Hello World', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40)
),
RaisedButton(
onPressed: () => _navigateToLogin(context),
child: Text('Login'),
),
RaisedButton(
onPressed: () => _navigateToRegistrasi(context),
child: Text('Registrasi'),
onPressed: () => _navigateToLanding(context),
child: Text('Landing'),
),
],
),
......@@ -105,13 +100,8 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
void _navigateToLogin(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Login());
Navigator.of(context).push(route);
}
void _navigateToRegistrasi(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Registrasi());
void _navigateToLanding(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Landing());
Navigator.of(context).push(route);
}
}
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/login/login.dart';
import 'package:ppl_disabilitas/page/registrasi/registrasi.dart';
import 'package:ppl_disabilitas/utils/customButton.dart';
class Landing extends StatelessWidget {
const Landing({Key key}) : super(key: key);
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xff3A903A),
),
backgroundColor: Color(0xff3A903A),
body: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(20, 30, 20, 10),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 60,
child: RaisedButton(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.all(Radius.circular(10)),
),
child: Text(
'Masuk',
style: TextStyle(fontSize: 25, color: Color(0xff3A903A), fontWeight: FontWeight.bold),
),
onPressed: () => _navigateToLogin(context),
),
)
),
Container(
child: separator('ATAU', 20, 0xffFFFFFF, 2, 0xffFFFFFF),
),
Container(
margin: EdgeInsets.fromLTRB(20, 10, 20, 30),
alignment: Alignment.center,
child: ButtonTheme(
minWidth: double.infinity,
height: 60,
child: RaisedButton(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.all(Radius.circular(10)),
),
child: Text(
'Daftar',
style: TextStyle(fontSize: 25, color: Color(0xff3A903A), fontWeight: FontWeight.bold),
),
onPressed: () => _navigateToRegistrasi(context),
),
)
),
],
),
),
);
}
void _navigateToLogin(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Login());
Navigator.of(context).push(route);
}
void _navigateToRegistrasi(BuildContext context) {
final route = MaterialPageRoute(builder: (_) => Registrasi());
Navigator.of(context).push(route);
}
}
\ No newline at end of file
......@@ -71,7 +71,7 @@ class LoginState extends State<Login> {
)
),
Container(
child: separator('Atau masuk dengan'),
child: separator('Atau masuk dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
......
......@@ -73,7 +73,7 @@ class RegistrasiState extends State<Registrasi> {
)
),
Container(
child: separator('Atau daftar dengan'),
child: separator('Atau daftar dengan', 12, 0xff000000, 1, 0xff000000),
),
Container(
margin: EdgeInsets.fromLTRB(0, 10, 0, 30),
......
......@@ -17,13 +17,11 @@ Color fillColor, Color textColor, void function()) {
text,
style: TextStyle(fontSize: 20, color: textColor, fontWeight: FontWeight.bold),
),
onPressed: () {
function();
},
onPressed: () => function(),
);
}
Widget separator(String text) {
Widget separator(String text, double textSize, int textColor, double thickness, int color) {
return Row(
children: <Widget>[
SizedBox(
......@@ -33,16 +31,19 @@ Widget separator(String text) {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Divider(
thickness: 1,
thickness: thickness,
color: Color(color),
),
),
),
Text(text),
Text(text,
style: TextStyle(fontSize: textSize, color: Color(textColor))),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Divider(
thickness: 1,
thickness: thickness,
color: Color(color),
),
),
),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment