Skip to content

Commit

Permalink
conditional render login and onboarding page v1/v2
Browse files Browse the repository at this point in the history
  • Loading branch information
reorr committed Mar 25, 2024
1 parent dbeebd4 commit 1693332
Show file tree
Hide file tree
Showing 19 changed files with 536 additions and 371 deletions.
Binary file added app/assets/icon/ic_google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/ic_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/ic_onboard_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/ic_onboard_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/ic_onboard_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions app/ios/Runner.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions app/lib/core/bases/widgets/atoms/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Button extends StatelessWidget {
final Color customButtonColor;
final Color customTextColor;
final Color customBorderColor;
final String icon;
final double borderRadius;

const Button({
Expand All @@ -31,6 +32,7 @@ class Button extends StatelessWidget {
this.customTextColor = BaseColors.black,
this.borderRadius = 16,
this.customBorderColor = Colors.transparent,
this.icon = '',
super.key,
});

Expand Down Expand Up @@ -77,15 +79,25 @@ class Button extends StatelessWidget {
border: Border.all(color: customBorderColor),
),
width: double.infinity,
child: AutoSizeText(
text,
textAlign: TextAlign.center,
style: TextStyle(
color: textColor,
fontSize: fontSize,
fontWeight: FontWeight.w600,
),
minFontSize: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (icon != '')
Image.asset(
icon,
),
SizedBox(width: icon != '' ? 9.0 : 0),
AutoSizeText(
text,
textAlign: TextAlign.center,
style: TextStyle(
color: textColor,
fontSize: fontSize,
fontWeight: FontWeight.w600,
),
minFontSize: 2,
),
],
),
),
),
Expand Down
5 changes: 4 additions & 1 deletion app/lib/core/constants/assets.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
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';
static const iconGoogle = 'assets/icon/ic_google.png';
static const iconLogin = 'assets/images/ic_login.png';
static const bebrasPandaiText = 'assets/images/bebras-banner.png';
static const bLogo = 'assets/images/b-logo.webp';
static const studyBackground = 'assets/images/study-background.jpg';
Expand Down
23 changes: 23 additions & 0 deletions app/lib/core/constants/get_started.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
List<Map<String, dynamic>> getStartedList = [
{
'image': 'assets/images/ic_onboard_1.png',
'title': 'Temukan Dunia Pengetahuanmu!',
'description':
'Selamat datang di Bebras Pandai, tempat di mana kamu dapat membuka '
'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.'
},
{
'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'
}
];
2 changes: 2 additions & 0 deletions app/lib/core/theme/base_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ class BaseColors {
static const Color yellow = Color(0xFFfeb451);
static const Color asparagus = Color(0xFF6da34d);
static const Color grey = Colors.grey;
static const Color brightBlue = Color(0xFF1BB8E1);
static const Color greyCustom = Color(0xFFD9D9D9);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// import 'package:flutter/material.dart';
// import 'package:flutter_bloc/flutter_bloc.dart';
// import 'package:go_router/go_router.dart';
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';
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';
part 'sign_in_page.dart';
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
// part of '_pages.dart';
part of '_pages.dart';

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

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

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

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

// super.initState();
// }
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(),
// );
// }
// },
// ),
// );
// },
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ),
// );
// }
// }
@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(),
);
}
},
),
);
},
),
],
),
),
),
],
),
),
);
}
}
30 changes: 15 additions & 15 deletions app/lib/features/onboarding/presentation/pages/v2/_pages.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// 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 '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';
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 'update_dialog.dart';
part 'onboarding_page.dart';
part 'splash_screen.dart';
part 'update_dialog.dart';
Loading

0 comments on commit 1693332

Please sign in to comment.