feat: initiate activity screen with TabBar
This commit is contained in:
parent
5b94690d02
commit
9c61b87c6d
|
@ -1,6 +1,6 @@
|
|||
export 'package:go_router/go_router.dart';
|
||||
export 'package:rijig_mobile/core/utils/navigation.dart';
|
||||
export 'package:rijig_mobile/features/activity/activity_screen.dart';
|
||||
export 'package:rijig_mobile/features/activity/presentation/screen/activity_screen.dart';
|
||||
export 'package:rijig_mobile/features/cart/cart_screen.dart';
|
||||
export 'package:rijig_mobile/features/home/presentation/screen/home_screen.dart';
|
||||
export 'package:rijig_mobile/features/profil/presentation/screen/profil_screen.dart';
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:iconsax_flutter/iconsax_flutter.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
import 'package:rijig_mobile/core/router.dart';
|
||||
import 'package:rijig_mobile/features/activity/activity_screen.dart';
|
||||
import 'package:rijig_mobile/features/activity/presentation/screen/activity_screen.dart';
|
||||
import 'package:rijig_mobile/features/cart/cart_screen.dart';
|
||||
import 'package:rijig_mobile/features/home/presentation/screen/home_screen.dart';
|
||||
import 'package:rijig_mobile/features/profil/presentation/screen/profil_screen.dart';
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
|
||||
class ActivityScreen extends StatefulWidget {
|
||||
const ActivityScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ActivityScreen> createState() => _ActivityScreenState();
|
||||
}
|
||||
|
||||
class _ActivityScreenState extends State<ActivityScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final titleofscreen = "Aktivitas";
|
||||
return Scaffold(
|
||||
backgroundColor: whiteColor,
|
||||
body: Center(child: Text("ini adalah halaman $titleofscreen")),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||
import 'package:rijig_mobile/widget/tabbar_custom.dart';
|
||||
|
||||
class ActivityScreen extends StatefulWidget {
|
||||
const ActivityScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ActivityScreen> createState() => _ActivityScreenState();
|
||||
}
|
||||
|
||||
class _ActivityScreenState extends State<ActivityScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Aktifitas', style: Tulisan.subheading()),
|
||||
centerTitle: true,
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(40),
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
child: Container(
|
||||
height: 40,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
color: Colors.green.shade100,
|
||||
),
|
||||
child: TabBar(
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
dividerColor: Colors.transparent,
|
||||
indicator: BoxDecoration(
|
||||
color: primaryColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
labelColor: Colors.white,
|
||||
unselectedLabelColor: Colors.black54,
|
||||
tabs: [
|
||||
TabItem(title: 'Proses', count: 6),
|
||||
TabItem(title: 'Gak Eroh', count: 3),
|
||||
TabItem(title: 'Dibatalkan', count: 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: const TabBarView(
|
||||
children: [
|
||||
Center(child: Text('Proses Page')),
|
||||
Center(child: Text('Gak Eroh Page')),
|
||||
Center(child: Text('Dibatalkan Page')),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class TabItem extends StatelessWidget {
|
||||
final String title;
|
||||
final int count;
|
||||
|
||||
const TabItem({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.count,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tab(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
count > 0
|
||||
? Container(
|
||||
margin: const EdgeInsetsDirectional.only(start: 5),
|
||||
padding: const EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade200,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
count > 9 ? "9+" : count.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.black54,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(width: 0, height: 0),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue