Skip to content

Commit

Permalink
feat: modify home and add under construction page
Browse files Browse the repository at this point in the history
  • Loading branch information
ArvinCS committed Sep 6, 2023
1 parent 41dfba4 commit f3608cc
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 14 deletions.
33 changes: 32 additions & 1 deletion lib/core/theme/font_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,42 @@ import 'base_colors.dart';

class FontTheme {
// Black
static TextStyle blackBold20() {
static TextStyle blackTitle() {
return const TextStyle(
color: Colors.black, fontSize: 30, fontWeight: FontWeight.w500);
}

static TextStyle blackTitleBold() {
return const TextStyle(
color: Colors.black, fontSize: 30, fontWeight: FontWeight.w800);
}

static TextStyle blackSubtitleBold() {
return const TextStyle(
color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold);
}

static TextStyle blackTextBold() {
return const TextStyle(
color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold);
}

static TextStyle blackBold36() {
return const TextStyle(
color: Colors.black, fontSize: 36, fontWeight: FontWeight.bold);
}

// Gray
static TextStyle greyTitle() {
return const TextStyle(
color: Colors.black, fontSize: 30, fontWeight: FontWeight.w500);
}

static TextStyle grayBold36() {
return const TextStyle(
color: Colors.grey, fontSize: 36, fontWeight: FontWeight.bold);
}

// White
static TextStyle whiteBold20() {
return const TextStyle(
Expand Down
10 changes: 10 additions & 0 deletions lib/features/error/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';

import '../../../../core/bases/enum/button_type.dart';
import '../../../../core/bases/widgets/atoms/button.dart';
import '../../../../core/bases/widgets/layout/bebras_scaffold.dart';
import '../../../../core/constants/assets.dart';
import '../../../../core/theme/font_theme.dart';

part 'under_construction_page.dart';
49 changes: 49 additions & 0 deletions lib/features/error/presentation/pages/under_construction_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
part of '_pages.dart';

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

@override
State<UnderConstructionPage> createState() => _UnderConstructionPageState();
}

class _UnderConstructionPageState extends State<UnderConstructionPage> {
@override
Widget build(BuildContext context) {
return BebrasScaffold(
body: Padding(
padding: const EdgeInsets.all(32),
child: Column(
children: [
Image.asset(
Assets.bebrasPandaiText,
),
const SizedBox(
height: 60,
),
Text(
'Maaf fitur ini sedang dalam perbaikan',
style: FontTheme.blackTextBold(),
),
const SizedBox(
height: 20,
),
Image.asset(
Assets.logo,
),
SizedBox(
width: 200,
child: Button(
text: 'Kembali',
buttonType: ButtonType.primary,
onTap: () {
context.pop();
},
),
)
],
),
),
);
}
}
4 changes: 3 additions & 1 deletion lib/features/main/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../../core/bases/enum/button_type.dart';
import '../../../../core/bases/widgets/atoms/button.dart';
import '../../../../core/bases/widgets/layout/bebras_scaffold.dart';
import '../../../../core/theme/base_colors.dart';
import '../../../../core/constants/assets.dart';
import '../../../../core/theme/font_theme.dart';
import '../../../../services/firebase_service.dart';

Expand Down
77 changes: 66 additions & 11 deletions lib/features/main/presentation/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,98 @@ class _MainPageState extends State<MainPage> {

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
// final size = MediaQuery.of(context).size;

return BebrasScaffold(
body: SingleChildScrollView(
child: Stack(
children: [
Container(
height: size.height * 0.35,
color: BaseColors.blue,
),
Padding(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
Assets.bebrasPandaiText,
),
const SizedBox(
height: 100,
),
RichText(
text: TextSpan(
text: 'Halo! ',
style: FontTheme.whiteBold36(),
text: 'Selamat Datang\n',
style: FontTheme.blackTitle(),
children: <TextSpan>[
TextSpan(
text:
' ${FirebaseService.auth().currentUser?.displayName}',
style: FontTheme.redBold36(),
'${FirebaseService.auth().currentUser?.displayName},',
style: FontTheme.blackTitleBold(),
// recognizer: TapGestureRecognizer()
// ..onTap = () => context.go('/signup'),
),
],
),
),
const SizedBox(
height: 30,
),
Button(
buttonType: ButtonType.primary,
onTap: () async {
await context.push('/construction');
},
text: 'Lihat Materi',
),
const SizedBox(
height: 10,
),
Button(
buttonType: ButtonType.primary,
onTap: () async {
await context.push('/construction');
},
text: 'Cetak Materi',
),
const SizedBox(
height: 10,
),
Button(
buttonType: ButtonType.primary,
onTap: () async {
await context.push('/construction');
},
text: 'Ikut Quiz',
),
const SizedBox(
height: 10,
),
Button(
buttonType: ButtonType.primary,
onTap: () async {
await GoogleSignIn().signOut();
context.go('/onboarding');
},
text: 'Log out',
)
),
const SizedBox(
height: 60,
),
InkWell(
onTap: () async {
final url = Uri.parse(
'https://bebras.or.id/v3/bebras-indonesia-challenge-2022/');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
child: Center(
child: Text(
'Tentang Bebras Indonesia',
textAlign: TextAlign.center,
style: FontTheme.blackTextBold(),
),
),
),
],
),
),
Expand Down
5 changes: 5 additions & 0 deletions lib/services/router_service.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:go_router/go_router.dart';

import '../features/authentication/signin/presentation/pages/_pages.dart';
import '../features/error/presentation/pages/_pages.dart';
import '../features/main/presentation/pages/_pages.dart';
import '../features/onboarding/presentation/pages/_pages.dart';

Expand All @@ -18,5 +19,9 @@ GoRouter router = GoRouter(
path: '/main',
builder: (context, state) => const MainPage(),
),
GoRoute(
path: '/construction',
builder: (context, state) => const UnderConstructionPage(),
),
],
);
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import flutter_local_notifications
import geolocator_apple
import path_provider_foundation
import shared_preferences_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
Expand All @@ -19,4 +20,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
66 changes: 65 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27"
url: "https://pub.dev"
source: hosted
version: "6.1.14"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: b04af59516ab45762b2ca6da40fa830d72d0f6045cd97744450b73493fa76330
url: "https://pub.dev"
source: hosted
version: "6.1.0"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "7c65021d5dee51813d652357bc65b8dd4a6177082a9966bc8ba6ee477baa795f"
url: "https://pub.dev"
source: hosted
version: "6.1.5"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: b651aad005e0cb06a01dbd84b428a301916dc75f0e7ea6165f80057fee2d8e8e
url: "https://pub.dev"
source: hosted
version: "3.0.6"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: b55486791f666e62e0e8ff825e58a023fd6b1f71c49926483f1128d3bbd8fe88
url: "https://pub.dev"
source: hosted
version: "3.0.7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "95465b39f83bfe95fcb9d174829d6476216f2d548b79c38ab2506e0458787618"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: ba140138558fcc3eead51a1c42e92a9fb074a1b1149ed3c73e66035b2ccd94f2
url: "https://pub.dev"
source: hosted
version: "2.0.19"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "95fef3129dc7cfaba2bc3d5ba2e16063bb561fc6d78e63eee16162bc70029069"
url: "https://pub.dev"
source: hosted
version: "3.0.8"
uuid:
dependency: transitive
description:
Expand Down Expand Up @@ -1183,4 +1247,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.0.5 <4.0.0"
flutter: ">=3.7.0"
flutter: ">=3.10.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ dependencies:
google_sign_in: ^6.1.4
firebase_core: ^2.15.1
firebase_auth: ^4.9.0
url_launcher: ^6.1.14

dev_dependencies:
build_runner: null
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

#include <firebase_core/firebase_core_plugin_c_api.h>
#include <geolocator_windows/geolocator_windows.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
firebase_core
geolocator_windows
url_launcher_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down

0 comments on commit f3608cc

Please sign in to comment.