Skip to content

Commit

Permalink
Merge pull request #156 from ia-toki/redesign-v2
Browse files Browse the repository at this point in the history
Conditional render onboarding & login page for v1/v2
  • Loading branch information
gmochid authored Mar 25, 2024
2 parents ef523b8 + 1693332 commit 9e1947f
Show file tree
Hide file tree
Showing 18 changed files with 407 additions and 178 deletions.
2 changes: 1 addition & 1 deletion app/lib/core/bases/widgets/atoms/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class Button extends StatelessWidget {
this.fontSize = 16,
this.customButtonColor = Colors.transparent,
this.customTextColor = BaseColors.black,
this.borderRadius = 16,
this.customBorderColor = Colors.transparent,
this.icon = '',
this.borderRadius = 16,
super.key,
});

Expand Down
3 changes: 2 additions & 1 deletion app/lib/core/constants/assets.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Assets {
static const sourceImg = '{sourceImg}';
static const urlImg = 'https://storage.googleapis.com/toki-bebras-proto.appspot.com/uploads';
static const urlImg =
'https://storage.googleapis.com/toki-bebras-proto.appspot.com/uploads';
static const flagDir = 'assets/images/flags/';
static const icon = 'assets/icon/icon.png';
static const logo = 'assets/images/logo.png';
Expand Down
6 changes: 3 additions & 3 deletions app/lib/core/constants/get_started.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ List<Map<String, dynamic>> getStartedList = [
'title': 'Temukan Dunia Pengetahuanmu!',
'description':
'Selamat datang di Bebras Pandai, tempat di mana kamu dapat membuka '
'pintu menuju pengetahuan yang tak terbatas.'
'pintu menuju pengetahuan yang tak terbatas.'
},
{
'image': 'assets/images/ic_onboard_2.png',
'title': 'Pintu Gerbang Kecerdasan Terbuka',
'description':
'Setiap langkah akan membawa kita lebih dekat dengan pengetahuan '
'yang tak terbatas.'
'yang tak terbatas.'
},
{
'image': 'assets/images/ic_onboard_3.png',
'title': 'Temukan Keajaiban!',
'description':
'Setiap momen belajar menjadi petualangan yang penuh keceriaan. '
'Ayo bergabung dalam dan nikmati manfaat yang luar biasa'
'Ayo bergabung dalam dan nikmati manfaat yang luar biasa'
}
];
3 changes: 1 addition & 2 deletions app/lib/core/theme/base_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ class BaseColors {
static const Color asparagus = Color(0xFF6da34d);
static const Color grey = Colors.grey;
static const Color brightBlue = Color(0xFF1BB8E1);
static const Color greyCustome = Color(0xFFD9D9D9);

static const Color greyCustom = Color(0xFFD9D9D9);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:go_router/go_router.dart';
import '../../../../../core/bases/enum/button_type.dart';
import '../../../../../core/bases/widgets/atoms/button.dart';
import '../../../../../core/constants/assets.dart';
import '../../../../../core/theme/base_colors.dart';
import '../../../../../services/di.dart';
import '../bloc/sign_in_bloc.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,28 @@ class _LoginPageState extends State<LoginPage> {
child: Stack(
children: [
Image.asset(
Assets.iconLogin,
Assets.studyBackground,
fit: BoxFit.cover,
height: size.height * 0.30,
width: double.infinity,
height: size.height * 0.45,
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
padding: const EdgeInsets.all(32),
height: size.height * 0.55,
height: size.height * 0.6,
width: size.width,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(32),
// color: Colors.white,
// ),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(32),
color: Colors.white,
),
child: Column(
children: [
// Image.asset(
// Assets.bebrasPandaiText,
// ),
// const SizedBox(
// height: 100,
// ),
Image.asset(
Assets.bebrasPandaiText,
),
const SizedBox(
height: 100,
),
const Text(
'Selamat Datang di Aplikasi Bebras Pandai!',
textAlign: TextAlign.center,
Expand All @@ -63,7 +62,7 @@ class _LoginPageState extends State<LoginPage> {
'Yuk cari tahu seberapa tajam logikamu!',
),
const SizedBox(
height: 50,
height: 24,
),
BlocConsumer<SignInBloc, SignInState>(
bloc: _signInBloc,
Expand All @@ -80,9 +79,7 @@ class _LoginPageState extends State<LoginPage> {
width: 200,
child: Button(
text: 'Login with Google',
buttonType: ButtonType.secondary,
customBorderColor: BaseColors.black,
icon: Assets.iconGoogle,
buttonType: ButtonType.primary,
onTap: () {
if (state is! SignInLoadingState) {
_signInBloc.add(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';

import '../../../../../../core/bases/enum/button_type.dart';
import '../../../../../../core/bases/widgets/atoms/button.dart';
import '../../../../../../core/constants/assets.dart';
import '../../../../../../core/theme/base_colors.dart';
import '../../../../../../services/di.dart';
import '../../bloc/sign_in_bloc.dart';

part 'sign_in_page.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
part of '_pages.dart';

class LoginPageV2 extends StatefulWidget {
const LoginPageV2({super.key});

@override
State<LoginPageV2> createState() => _LoginPageV2State();
}

class _LoginPageV2State extends State<LoginPageV2> {
late final SignInBloc _signInBloc;

@override
void initState() {
_signInBloc = get<SignInBloc>();

super.initState();
}

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
return Scaffold(
body: SafeArea(
child: Stack(
children: [
Image.asset(
Assets.iconLogin,
fit: BoxFit.cover,
height: size.height * 0.30,
width: double.infinity,
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
padding: const EdgeInsets.all(32),
height: size.height * 0.55,
width: size.width,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(32),
// color: Colors.white,
// ),
child: Column(
children: [
// Image.asset(
// Assets.bebrasPandaiText,
// ),
// const SizedBox(
// height: 100,
// ),
const Text(
'Selamat Datang di Aplikasi Bebras Pandai!',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 24,
),
),
const SizedBox(
height: 24,
),
const Text(
'Yuk cari tahu seberapa tajam logikamu!',
),
const SizedBox(
height: 50,
),
BlocConsumer<SignInBloc, SignInState>(
bloc: _signInBloc,
listener: (context, state) {
if (state is UserUnregistered) {
context.go('/register');
} else if (state is UserRegistered) {
context.go('/main');
}
},
builder: (context, state) {
return SizedBox(
height: 50,
width: 200,
child: Button(
text: 'Login with Google',
buttonType: ButtonType.secondary,
customBorderColor: BaseColors.black,
icon: Assets.iconGoogle,
onTap: () {
if (state is! SignInLoadingState) {
_signInBloc.add(
TriggerSignInEvent(),
);
}
},
),
);
},
),
],
),
),
),
],
),
),
);
}
}
2 changes: 1 addition & 1 deletion app/lib/features/main/presentation/pages/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _SettingPageState extends State<SettingPage> {
onTap: () async {
await FirebaseAuth.instance.signOut();
await GoogleSignIn().signOut();
context.go('/login');
context.go('/onboarding');
},
customButtonColor: Colors.red.shade900,
customTextColor: Colors.white,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
// onTap: () async {
// await FirebaseAuth.instance.signOut();
// await GoogleSignIn().signOut();
// context.go('/onboarding');
// context.go('/login');
// },
// child: Container(
// padding:
Expand Down
7 changes: 1 addition & 6 deletions app/lib/features/onboarding/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:page_view_indicators/circle_page_indicator.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../../core/bases/widgets/atoms/button.dart';
import '../../../../core/constants/assets.dart';
import '../../../../core/constants/get_started.dart';
import '../../../../core/theme/base_colors.dart';
import '../../../../core/theme/font_theme.dart';
import '../bloc/user_initialization_bloc.dart';

part 'onboarding_page.dart';
part 'splash_screen.dart';
part 'onboarding_page.dart';
part 'update_dialog.dart';
Loading

0 comments on commit 9e1947f

Please sign in to comment.