From c04fd18d0aec5073cb9ef3c2696c94fbb015094f Mon Sep 17 00:00:00 2001 From: "michael.wiryadinata" Date: Thu, 4 Jun 2020 16:27:30 +0700 Subject: [PATCH 1/4] [CHORES] Upgrade dependencies --- pubspec.lock | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index d423dfc..8d97605 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 28be848..049b0d8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 -- GitLab From f0077edfe7429fd558a9b558b6233d01ee2bcc3c Mon Sep 17 00:00:00 2001 From: "michael.wiryadinata" Date: Thu, 4 Jun 2020 16:27:59 +0700 Subject: [PATCH 2/4] [REFACTOR] Update layout --- lib/Pages/Login/otp_page.dart | 39 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/lib/Pages/Login/otp_page.dart b/lib/Pages/Login/otp_page.dart index c3778b1..9d580e6 100644 --- a/lib/Pages/Login/otp_page.dart +++ b/lib/Pages/Login/otp_page.dart @@ -22,6 +22,13 @@ class OTPPage extends StatelessWidget { BlocProvider.of(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( listener: (context, state) { @@ -54,14 +61,32 @@ class OTPPage extends StatelessWidget { children: [ 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, -- GitLab From 805b72713de45d16b1c755aa81ab57bfbc004924 Mon Sep 17 00:00:00 2001 From: "michael.wiryadinata" Date: Thu, 4 Jun 2020 16:28:15 +0700 Subject: [PATCH 3/4] [REFACTOR] Update code --- lib/Component/theme.dart | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/Component/theme.dart b/lib/Component/theme.dart index e455761..f0615bd 100644 --- a/lib/Component/theme.dart +++ b/lib/Component/theme.dart @@ -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), + ), + ), + ); } } -- GitLab From ada6a3a0f911c63e3e2b2dd72737722acb3080a8 Mon Sep 17 00:00:00 2001 From: "michael.wiryadinata" Date: Thu, 4 Jun 2020 16:34:27 +0700 Subject: [PATCH 4/4] [REFACTOR] Remove bloc delegate --- lib/main.dart | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index b4874db..d73f0a4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,3 @@ -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 main() async { WidgetsFlutterBinding.ensureInitialized(); await GlobalConfiguration().loadFromAsset('app_settings'); @@ -47,7 +26,6 @@ Future 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( -- GitLab