Skip to content

Commit

Permalink
revamp halaman home
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad8taufiq committed Apr 4, 2024
1 parent e284ec1 commit defc45f
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 145 deletions.
2 changes: 1 addition & 1 deletion app/lib/core/bases/widgets/layout/bottom_navbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
void _onTap(int index, BuildContext context) {
switch (index) {
case 0:
context.go('/main');
context.go('/material');
break;
case 1:
context.go('/setting');
Expand Down
15 changes: 8 additions & 7 deletions app/lib/features/main/presentation/pages/v2/_pages.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// import 'package:carousel_slider/carousel_slider.dart';
// import 'package:firebase_auth/firebase_auth.dart';
// import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
// import 'package:flutter_bloc/flutter_bloc.dart';
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
// import 'package:go_router/go_router.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:go_router/go_router.dart';
// import 'package:google_sign_in/google_sign_in.dart';
// import 'package:intl/intl.dart';
// import 'package:url_launcher/url_launcher.dart';

// import '../../../../../core/bases/widgets/atoms/button.dart';
// import '../../../../../core/bases/widgets/layout/bebras_scaffold.dart';
// import '../../../../../core/bases/widgets/layout/bottom_navbar.dart';
import '../../../../../core/bases/widgets/atoms/button.dart';
import '../../../../../core/bases/widgets/layout/bebras_scaffold.dart';
import '../../../../../core/constants/assets.dart';
import '../../../../../core/bases/widgets/layout/bottom_navbar.dart';
// import '../../../../../core/theme/font_theme.dart';
// import '../../../../../services/firebase_service.dart';
// import '../../../../material/menu/presentation/pages/_pages.dart';
// import '../../bloc/home_cubit.dart';
// import 'clip_path.dart';

// part 'home_page.dart';
part 'home_page.dart';
// part 'setting_page.dart';
299 changes: 164 additions & 135 deletions app/lib/features/main/presentation/pages/v2/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,141 +1,170 @@
// part of '_pages.dart';
part of '_pages.dart';

// class HomePage extends StatefulWidget {
// const HomePage({super.key});
class HomePageV2 extends StatefulWidget {
const HomePageV2({super.key});

// @override
// State<HomePage> createState() => _HomePageState();
// }
@override
State<HomePageV2> createState() => _HomePageV2State();
}

// final List<String> imgList = [
// 'https://pandai.bebras.or.id/img/carousel5.ad104915.png',
// 'https://pandai.bebras.or.id/img/banner2023.95952847.jpeg',
// 'https://pandai.bebras.or.id/img/bebrasBanner.96a43a30.jpg',
// 'https://pandai.bebras.or.id/img/grow-with-google-bebras-id.8d80a623.jpg',
// ];
class _HomePageV2State extends State<HomePageV2> {
String version = '';

// class Course {
// String title;
// String description;
@override
void initState() {
super.initState();
}

// Course(this.title, this.description);
// }
Future<void> showModal() async {
return showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
height: 260,
width: double.infinity,
color: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(
height: 40,
),
Container(
margin: const EdgeInsets.only(left: 20),
child: const Text(
'Ayo pilih latihanmu!',
textAlign: TextAlign.left,
style:
TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
),
const SizedBox(
height: 25,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 40),
width: double.infinity,
child: const Button(
customButtonColor: const Color(0xFF1BB8E1),
customTextColor: Colors.white,
text: 'Unduh Latihan Minggu Ini',
),
),
const SizedBox(
height: 20,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 40),
width: double.infinity,
child: const Button(
customTextColor: const Color(0xFF1BB8E1),
customButtonColor: const Color(0x1F1BB8E1),
text: 'Latihan Minggu Depan',
),
),
],
),
);
},
);
},
).whenComplete(() => null);
}

// class _HomePageState extends State<HomePage> {
// @override
// void initState() {
// context.read<HomeCubit>().fetchUser();
// super.initState();
// }

// @override
// Widget build(BuildContext context) {
// return BebrasScaffold(
// body: Stack(
// children: [
// ClipPath(
// clipper: ClipPathClass(),
// child: Container(
// height: 250,
// color: const Color(0xFF1BB8E1),
// ),
// ),
// Column(
// children: [
// Padding(
// padding: const EdgeInsets.only(
// left: 32, right: 32, top: 32, bottom: 16),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// BlocBuilder<HomeCubit, HomeState>(
// builder: (context, state) {
// if (state is HomeSuccess) {
// return RichText(
// text: TextSpan(
// text: 'Selamat Datang\n',
// style: const TextStyle(
// color: Colors.white,
// fontSize: 20,
// fontWeight: FontWeight.w400,
// ),
// children: <TextSpan>[
// TextSpan(
// text: toBeginningOfSentenceCase(
// '${state.user.name}!',
// ),
// style: const TextStyle(
// color: Colors.white,
// fontSize: 20,
// fontWeight: FontWeight.w600,
// ),
// ),
// ],
// ),
// );
// }
// return Container();
// }),
// const SizedBox(
// height: 30,
// ),
// CarouselSlider(
// items: imgList
// .map(
// (item) => InkWell(
// onTap: () async {
// final Uri url = Uri.parse(
// 'https://bebras.or.id/v3/bebras-indonesia-challenge-2023/');
// if (!await launchUrl(url)) {
// throw Exception('Could not launch $url');
// }
// }, // Handle your callback
// child: Container(
// margin: const EdgeInsets.only(
// left: 10,
// right: 10,
// ),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10),
// color: Colors.transparent,
// ),
// child: ClipRRect(
// borderRadius: BorderRadius.circular(10),
// child: Image.network(
// item,
// fit: BoxFit.cover,
// width: double.infinity,
// ),
// ),
// ),
// ),
// )
// .toList(),
// options: CarouselOptions(
// height: 150,
// viewportFraction: 1,
// autoPlay: true,
// autoPlayInterval: const Duration(seconds: 3),
// ),
// ),
// ],
// ),
// ),
// const MaterialMenu(),
// ],
// ),
// ],
// ),
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
// floatingActionButton: FloatingActionButton(
// onPressed: () {
// context.go('/quiz_registration');
// },
// child: const FaIcon(FontAwesomeIcons.graduationCap),
// ),
// bottomNavigationBar: const BottomNavBar(
// currentIndex: 0,
// ),
// );
// }
// }
@override
Widget build(BuildContext context) {
return BebrasScaffold(
body: Container(
color: const Color(0xFF1BB8E1),
child: Stack(
children: [
Column(
children: [
const SizedBox(
height: 60,
),
Container(
alignment: Alignment.center,
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: Image.asset(
Assets.bLogo,
height: 150,
),
),
),
],
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 300,
width: double.infinity,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(42),
topRight: Radius.circular(42),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Ayo mulai latihanmu!',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18,
),
),
const SizedBox(
height: 30,
),
SizedBox(
width: 230,
child: Button(
customTextColor: Colors.white,
customButtonColor: Color(0xFF1BB8E1),
fontSize: 14,
innerVerticalPadding: 14,
onTap: () async {
await showModal();
},
text: 'Daftar Latihan',
),
),
const SizedBox(
height: 10,
),
const SizedBox(
width: 230,
child: Button(
customTextColor: const Color(0xFF1BB8E1),
customButtonColor: const Color(0x1F1BB8E1),
fontSize: 14,
innerVerticalPadding: 14,
text: 'Riwayat Latihan',
),
),
],
),
),
),
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton(
onPressed: () {
context.go('/quiz_registration');
},
child: const FaIcon(FontAwesomeIcons.graduationCap),
),
bottomNavigationBar: const BottomNavBar(
currentIndex: 2,
),
);
}
}
4 changes: 2 additions & 2 deletions app/lib/services/router_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import '../features/quiz_result/presentation/pages/_pages.dart';
import '../features/quiz_start/presentation/pages/_pages.dart';
import '../features/task_detail/presentation/pages/_pages.dart';
import '../features/task_list/presentation/pages/_pages.dart';
// import '../features/main/presentation/pages/v2/_pages.dart';
import '../features/main/presentation/pages/v2/_pages.dart';

GoRouter router = GoRouter(
routes: [
Expand Down Expand Up @@ -68,7 +68,7 @@ GoRouter router = GoRouter(
if (dotenv.env['APP_VERSION'] == 'V1') {
return const HomePage();
} else if (dotenv.env['APP_VERSION'] == 'V2') {
// return const V2HomePage();
return const HomePageV2();
}
return const HomePage();
},
Expand Down

0 comments on commit defc45f

Please sign in to comment.