91 lines
2.7 KiB
Dart
91 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:onufitness/constants/string_constant.dart';
|
|
import 'package:onufitness/constants/text_constant.dart';
|
|
import 'package:onufitness/routes/route_constant.dart';
|
|
import 'package:onufitness/screens/rise/controllers/rise_controller.dart';
|
|
import 'package:onufitness/screens/rise/views/created_by_me_tab.dart';
|
|
import 'package:onufitness/screens/rise/views/explore_tab.dart';
|
|
import 'package:onufitness/screens/rise/views/joined_tab.dart';
|
|
import 'package:onufitness/utils/helper_function.dart';
|
|
|
|
class RiseScreen extends StatefulWidget {
|
|
const RiseScreen({super.key});
|
|
|
|
@override
|
|
State<RiseScreen> createState() => _RiseScreenState();
|
|
}
|
|
|
|
class _RiseScreenState extends State<RiseScreen> {
|
|
RiseController? controller;
|
|
int initialTabIndex = 0;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
if (!Get.isRegistered<RiseController>()) {
|
|
controller = Get.put(RiseController());
|
|
} else {
|
|
controller = Get.find<RiseController>();
|
|
}
|
|
|
|
final args = Get.arguments;
|
|
if (args != null && args['tabIndex'] != null) {
|
|
initialTabIndex = args['tabIndex'];
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DefaultTabController(
|
|
length: 3,
|
|
initialIndex: initialTabIndex,
|
|
child: Scaffold(
|
|
backgroundColor: Colors.white,
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.white,
|
|
leading: IconButton(
|
|
icon: const Icon(Icons.arrow_back_ios),
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
title: const Text(
|
|
'Rise',
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
actions: [
|
|
Padding(
|
|
padding: EdgeInsets.only(right: 10.w),
|
|
child: IconButton(
|
|
icon: Icon(Icons.add, size: isTablet ? 30.sp : 25.h),
|
|
onPressed: () {
|
|
Get.toNamed(RouteConstant.createChallengeScreen);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
bottom: TabBar(
|
|
labelColor: Colors.black,
|
|
unselectedLabelColor: Colors.grey,
|
|
indicatorColor: Colors.black,
|
|
tabs: const [
|
|
Tab(text: "Explore"),
|
|
Tab(text: riseCreatedByMeTab),
|
|
Tab(text: riseJoinedTab),
|
|
],
|
|
labelStyle: TextStyle(
|
|
fontSize: verySmallSizeText,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
unselectedLabelStyle: TextStyle(fontSize: verySmallSizeText),
|
|
),
|
|
),
|
|
body: TabBarView(children: [ExploreTab(), CreatedTab(), JoinedTab()]),
|
|
),
|
|
);
|
|
}
|
|
}
|