Fakultas Ilmu Komputer UI

Commit b7fc71c2 authored by Michael Wiryadinata Halim's avatar Michael Wiryadinata Halim
Browse files

Merge branch '50-fix-pinput-otp' into 'staging'

Resolve "Fix pinput otp"

Closes #50

See merge request !77
parents 52268e9c 06ae90f4
Pipeline #49750 passed with stages
in 18 minutes and 37 seconds
......@@ -4,31 +4,32 @@ import 'package:google_fonts/google_fonts.dart';
class AppTheme {
static ThemeData custom(ThemeData base) {
return base.copyWith(
appBarTheme: base.appBarTheme.copyWith(
color: Colors.white,
iconTheme: IconThemeData(color: Colors.black87),
elevation: 0.5,
textTheme: GoogleFonts.montserratTextTheme(base.textTheme)),
textTheme: GoogleFonts.montserratTextTheme(base.textTheme).apply(
bodyColor: Colors.black,
displayColor: Colors.black,
appBarTheme: base.appBarTheme.copyWith(
color: Colors.white,
iconTheme: IconThemeData(color: Colors.black87),
elevation: 0.5,
textTheme: GoogleFonts.montserratTextTheme(base.textTheme)),
textTheme: GoogleFonts.montserratTextTheme(base.textTheme).apply(
bodyColor: Colors.black,
displayColor: Colors.black,
),
primaryColor: const Color(0xff3C8DBC),
iconTheme: IconThemeData(color: Colors.grey),
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
inputDecorationTheme: const InputDecorationTheme(
contentPadding: EdgeInsets.symmetric(horizontal: 2),
labelStyle: TextStyle(color: Color(0xff4E7890)),
fillColor: Color(0xffF1F1F1),
filled: true,
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890)),
),
primaryColor: const Color(0xff3C8DBC),
iconTheme: IconThemeData(color: Colors.grey),
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
inputDecorationTheme: const InputDecorationTheme(
contentPadding: EdgeInsets.symmetric(horizontal: 2),
labelStyle: TextStyle(color: Color(0xff4E7890)),
fillColor: Color(0xffF1F1F1),
filled: true,
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890), width: 2.4),
),
));
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890), width: 2.4),
),
),
);
}
}
......@@ -22,6 +22,13 @@ class OTPPage extends StatelessWidget {
BlocProvider.of<LoginBloc>(context).add(ResubmitOTP(tokenBearer));
}
BoxDecoration get _pinPutDecoration {
return BoxDecoration(
border: Border.all(color: const Color(0xff4E7890)),
borderRadius: BorderRadius.circular(15),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
......@@ -32,7 +39,7 @@ class OTPPage extends StatelessWidget {
),
iconTheme: const IconThemeData(color: Colors.white),
centerTitle: true,
backgroundColor: Theme.of(context).primaryColor,
backgroundColor: const Color(0xff4E7890),
),
body: BlocListener<LoginBloc, LoginState>(
listener: (context, state) {
......@@ -54,14 +61,32 @@ class OTPPage extends StatelessWidget {
children: <Widget>[
const Text('Mohon masukkan OTP yang dikirim ke nomor anda',
softWrap: true),
PinPut(
onSubmit: (String pin) {
_otpSubmitted(pin, context);
},
fieldsCount: 6,
Divider(
height: 20,
thickness: null,
),
Theme(
data: Theme.of(context)
.copyWith(inputDecorationTheme: InputDecorationTheme()),
child: PinPut(
onSubmit: (String pin) {
_otpSubmitted(pin, context);
},
submittedFieldDecoration: _pinPutDecoration.copyWith(
borderRadius: BorderRadius.circular(20)),
selectedFieldDecoration: _pinPutDecoration,
followingFieldDecoration: _pinPutDecoration.copyWith(
borderRadius: BorderRadius.circular(5),
border: Border.all(
color: const Color(0xff3C8DBC),
),
),
fieldsCount: 6,
),
),
Container(
height: MediaQuery.of(context).size.height / 17,
margin: EdgeInsets.only(top: 10),
height: MediaQuery.of(context).size.height / 18,
child: ButtonResendOTP(
label: 'Kirim Ulang OTP',
onClick: _otpResend,
......
import 'package:bloc/bloc.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
......@@ -16,26 +15,6 @@ import 'package:intl/intl.dart';
import 'home_industry_app.dart';
class SimpleBlocDelegate extends BlocDelegate {
@override
void onEvent(Bloc bloc, Object event) {
super.onEvent(bloc, event);
print(event);
}
@override
void onTransition(Bloc bloc, Transition transition) {
super.onTransition(bloc, transition);
print(transition);
}
@override
void onError(Bloc bloc, Object error, StackTrace stackTrace) {
super.onError(bloc, error, stackTrace);
print(error);
}
}
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await GlobalConfiguration().loadFromAsset('app_settings');
......@@ -47,7 +26,6 @@ Future<void> main() async {
});
final options = BaseOptions(baseUrl: GlobalConfiguration().getString('url'));
final dio = Dio(options);
BlocSupervisor.delegate = SimpleBlocDelegate();
const secureStorage = FlutterSecureStorage();
final authRepository = AuthRepository(storage: secureStorage, dio: dio);
runApp(BlocProvider<AuthenticationBloc>(
......
......@@ -189,7 +189,7 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.9"
version: "0.13.10"
crypto:
dependency: transitive
description:
......
......@@ -29,7 +29,7 @@ dependencies:
dio: ^3.0.9
flutter_secure_storage: ^3.3.3
json_annotation: ^3.0.1
pinput: ^0.2.3
pinput: ^0.2.4
flutter_easyloading: ^1.1.4
intl: ^0.16.1
stream_transform: ^1.2.0
......
Markdown is supported
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