3226 lines
143 KiB
Dart
3226 lines
143 KiB
Dart
// ignore_for_file: prefer_const_constructors
|
|
|
|
import 'dart:async';
|
|
import 'dart:io';
|
|
// import 'package:flutter_background_service/flutter_background_service.dart';
|
|
// import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
import 'package:gsp_app/view_model/QuizApis.dart';
|
|
import 'package:gsp_app/views/components/floating_action_btn.dart';
|
|
import 'package:gsp_app/views/pages/podcast/viewModel/PodcastApis.dart';
|
|
import 'package:gsp_app/views/pages/quiz/quiz_home.dart';
|
|
import 'package:gsp_app/views/pages/splash.dart';
|
|
// import 'package:flutter_background_service_android/flutter_background_service_android.dart';
|
|
|
|
import '../../../repository/services/feedbackServices.dart';
|
|
import '/api/base_manager.dart' as cresponse;
|
|
|
|
import 'package:animations/animations.dart';
|
|
import 'package:carousel_slider/carousel_slider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_background/flutter_background.dart';
|
|
import 'package:get/get.dart';
|
|
// import 'package:gsp_app/pages/blog/blog_inner.dart';
|
|
import 'package:get_storage/get_storage.dart';
|
|
import 'package:gsp_app/repository/services/StoreLauncher.dart';
|
|
import 'package:gsp_app/repository/services/cj/manage_banner_service.dart';
|
|
import 'package:gsp_app/view_model/GetMoodometerValue.dart';
|
|
import 'package:gsp_app/view_model/StepcountController.dart';
|
|
import 'package:gsp_app/view_model/Stepcounts.dart';
|
|
import 'package:gsp_app/view_model/VersionControl.dart';
|
|
import 'package:gsp_app/view_model/app_data_controller.dart';
|
|
import 'package:gsp_app/view_model/app_tour_controller.dart';
|
|
import 'package:gsp_app/views/components/page_animation.dart';
|
|
import 'package:gsp_app/views/components/videos_not_found.dart';
|
|
import 'package:gsp_app/views/pages/StepCount/HealthApp.dart';
|
|
import 'package:gsp_app/views/pages/courses/courses_overview.dart';
|
|
import 'package:lottie/lottie.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
import 'package:pedometer/pedometer.dart';
|
|
import 'package:skeletons/skeletons.dart';
|
|
import '../../../modals/leaderboard_ranking_model.dart';
|
|
import '../../../modals/rank_position.dart';
|
|
import '../../../modals/share_thoughts.dart';
|
|
import '../../../repository/response_data.dart';
|
|
import '../../../repository/services/cj/leader_board_ranking.dart';
|
|
import '../../../repository/services/cj/moodOmeter_services.dart';
|
|
import '../../../repository/services/home_controller.dart';
|
|
import '../../../repository/services/share_thoughts_service.dart';
|
|
import '../../../view_model/common_functions.dart';
|
|
import '../../../view_model/global_controller.dart';
|
|
import '../../../view_model/my_ranking_controller.dart';
|
|
import '../../components/custom_skeleton.dart';
|
|
import '../../components/mood_meter.dart';
|
|
import '../../components/notification_icon.dart';
|
|
import '../../../modals/manage_banner_model.dart';
|
|
import '../../../modals/short_clip_likes_model.dart';
|
|
import '../../../modals/short_clip_model.dart';
|
|
import '../../../repository/services/complete_profile_service.dart';
|
|
import '../../../repository/services/edit_profile_service.dart';
|
|
import '../../../repository/services/meet_community_service.dart';
|
|
import '../../../repository/services/short_clip_service.dart';
|
|
import '../../components/upcoming_session.dart';
|
|
import '../../short_video_player/svp_main.dart';
|
|
import '../bioMaker/controller.dart';
|
|
import '../diet_plan/diet_chart_preview.dart';
|
|
import '../insta/insta_clip_list.dart';
|
|
import '../podcast/podcast.dart';
|
|
import '../podcast/podcast_list_audio.dart';
|
|
import '../settings/setting_main.dart';
|
|
import '../../components/bottom_navigation.dart';
|
|
import '../../components/btn.dart';
|
|
import '../../../view_model/bottom_navigation_controller.dart';
|
|
import '../../../view_model/home_controller.dart';
|
|
import '../../../view_model/home_page_controller.dart';
|
|
import '../../../modals/member_modal.dart';
|
|
import '../../theme.dart';
|
|
import '../community/community.dart';
|
|
import '../sidebar.dart';
|
|
import '../signIn/sign_in.dart';
|
|
import 'package:async/async.dart';
|
|
|
|
StepCountController stepController = Get.put(StepCountController());
|
|
|
|
String groupLevelNameGlobal = '';
|
|
//int? appStepCountGlobal = 0;
|
|
// Define the reactive variable
|
|
// @pragma('vm:entry-point')
|
|
// void onStart(ServiceInstance service) async {
|
|
// // Only available for flutter 3.0.0 and later
|
|
// DartPluginRegistrant.ensureInitialized();
|
|
|
|
// // For flutter prior to version 3.0.0
|
|
// // We have to register the plugin manually
|
|
|
|
// SharedPreferences preferences = await SharedPreferences.getInstance();
|
|
// await preferences.setString("hello", "world");
|
|
|
|
// /// OPTIONAL when use custom notification
|
|
// final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
|
// FlutterLocalNotificationsPlugin();
|
|
|
|
// if (service is AndroidServiceInstance) {
|
|
// service.on('setAsForeground').listen((event) {
|
|
// service.setAsForegroundService();
|
|
// });
|
|
|
|
// service.on('setAsBackground').listen((event) {
|
|
// service.setAsBackgroundService();
|
|
// });
|
|
// }
|
|
|
|
// service.on('stopService').listen((event) {
|
|
// service.stopSelf();
|
|
// });
|
|
|
|
// // bring to foreground
|
|
// // Timer.periodic(const Duration(seconds: 1), (timer) async {
|
|
// // if (service is AndroidServiceInstance) {
|
|
// // if (await service.isForegroundService()) {
|
|
// // /// OPTIONAL for use custom notification
|
|
// // /// the notification id must be equals with AndroidConfiguration when you call configure() method.
|
|
// // flutterLocalNotificationsPlugin.show(
|
|
// // 888,
|
|
// // 'COOL SERVICE',
|
|
// // 'Awesome ${DateTime.now()}',
|
|
// // const NotificationDetails(
|
|
// // android: AndroidNotificationDetails(
|
|
// // 'my_foreground',
|
|
// // 'MY FOREGROUND SERVICE',
|
|
// // icon: 'ic_bg_service_small',
|
|
// // ongoing: true,
|
|
// // ),
|
|
// // ),
|
|
// // );
|
|
|
|
// // // if you don't using custom notification, uncomment this
|
|
// // service.setForegroundNotificationInfo(
|
|
// // title: "GSF health service",
|
|
// // content:
|
|
// // "Step count ${stepController.appStepCountGlobal.value.toString()}",
|
|
// // );
|
|
// // }
|
|
// // }
|
|
|
|
// // /// you can see this log in logcat
|
|
// // print('FLUTTER BACKGROUND SERVICE: ${DateTime.now()}');
|
|
|
|
// // // // test using external plugin
|
|
// // // final deviceInfo = DeviceInfoPlugin();
|
|
// // // String? device;
|
|
// // // if (Platform.isAndroid) {
|
|
// // // final androidInfo = await deviceInfo.androidInfo;
|
|
// // // device = androidInfo.model;
|
|
// // // }
|
|
|
|
// // // if (Platform.isIOS) {
|
|
// // // final iosInfo = await deviceInfo.iosInfo;
|
|
// // // device = iosInfo.model;
|
|
// // // }
|
|
|
|
// // // service.invoke(
|
|
// // // 'update',
|
|
// // // {
|
|
// // // "current_date": DateTime.now().toIso8601String(),
|
|
// // // "device": device,
|
|
// // // },
|
|
// // // );
|
|
// // });
|
|
// }
|
|
|
|
class Home extends StatefulWidget {
|
|
const Home({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<Home> createState() => _HomeState();
|
|
}
|
|
|
|
class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
|
late AnimationController _animationController;
|
|
StepCountController stepController = Get.put(StepCountController());
|
|
|
|
FutureGroup futureGroup = FutureGroup();
|
|
int? moodCheckResult;
|
|
|
|
ContainerTransitionType transitionType = ContainerTransitionType.fade;
|
|
HomeApiController homeApiController = Get.put(HomeApiController());
|
|
|
|
Future<bool> showExitPopup() async {
|
|
// return Get.aler;
|
|
return await showDialog(
|
|
//show confirm dialogue
|
|
//the return value will be from "Yes" or "No" options
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
elevation: 10,
|
|
backgroundColor: Colors.black,
|
|
title: const Text(
|
|
'Exit App',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: ColorConstants.kWhite,
|
|
),
|
|
),
|
|
content: const Text(
|
|
'Do you want to exit an App?',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: ColorConstants.kWhite,
|
|
),
|
|
),
|
|
actionsAlignment: MainAxisAlignment.spaceAround,
|
|
actions: [
|
|
ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: ColorConstants.kPrimaryColor,
|
|
),
|
|
onPressed: () => Navigator.of(context).pop(false),
|
|
//return false when click on "NO"
|
|
child: const Text(
|
|
'No',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: ColorConstants.kBlack,
|
|
),
|
|
),
|
|
),
|
|
ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: ColorConstants.kPrimaryColor,
|
|
),
|
|
onPressed: () => Navigator.of(context).pop(true),
|
|
//return true when click on "Yes"
|
|
child: const Text(
|
|
'Yes',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: ColorConstants.kBlack,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
) ??
|
|
false; //if showDialouge had returned null, then return false
|
|
}
|
|
|
|
final TabsController controller = TabsController();
|
|
final NavigationCrontroller navController = Get.put(NavigationCrontroller());
|
|
|
|
final CompleteProfileController completeProfileController =
|
|
Get.put(CompleteProfileController(), permanent: true);
|
|
|
|
var members =
|
|
memberDetails.map((e) => MeetTheCommunityModel.fromJson(e)).toList();
|
|
|
|
double textOpacity = 0.0;
|
|
final EditProfileController getProfileDatas =
|
|
Get.put(EditProfileController());
|
|
AppDataController appDataController = Get.find();
|
|
final StoreLauncher storeLauncher = Get.put(StoreLauncher());
|
|
|
|
var appTourController = Get.put(AppTourController());
|
|
final aControllerFind = Get.put(AController());
|
|
GlobalController globalContoller = Get.put(GlobalController());
|
|
bool? showMoodOMeterAfterAppTour;
|
|
|
|
var bannerMoodOMeterFutureGroup = FutureGroup();
|
|
|
|
@override
|
|
void initState() {
|
|
bannerMoodOMeterFutureGroup.add(MoodOMeterService().getMoodOMeter());
|
|
bannerMoodOMeterFutureGroup.add(ManageBannerService().fetchManageBanner());
|
|
bannerMoodOMeterFutureGroup.add(FeedbackServices().getFeedbackApi());
|
|
QuizeApis().showQuiz();
|
|
bannerMoodOMeterFutureGroup.close();
|
|
|
|
_animationController = AnimationController(
|
|
duration: const Duration(milliseconds: 600),
|
|
vsync: this,
|
|
);
|
|
_animationController.forward();
|
|
if (GetStorage().read("showAppTour") ?? false) {
|
|
showMoodOMeterAfterAppTour = true;
|
|
|
|
Future.delayed(const Duration(seconds: 1), () {
|
|
appTourController.startAppTour(context, () {
|
|
setState(() {
|
|
showMoodOMeterAfterAppTour = false;
|
|
});
|
|
});
|
|
});
|
|
GetStorage().write("showAppTour", false);
|
|
print("tour done");
|
|
} else {}
|
|
|
|
initiatePedometerModule();
|
|
if (Platform.isAndroid) initBackgroundProcess();
|
|
_getAppVersion();
|
|
// initializeService();
|
|
super.initState();
|
|
GetMoodometerValue().getmoodValue();
|
|
}
|
|
|
|
Future<void> _getAppVersion() async {
|
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
|
if (Platform.isAndroid) {
|
|
var updata = {"old_version_android": packageInfo.buildNumber};
|
|
final data = await VersionControl().storeCurrentVersion(updata);
|
|
if (data.status == cresponse.ResponseStatus.SUCCESS) {
|
|
final data1 = await VersionControl().getCurrentVersion();
|
|
if (data1.status == cresponse.ResponseStatus.SUCCESS) {
|
|
if (packageInfo.buildNumber != version!.result!.newVersionAndroid!) {
|
|
appUpdateDialog(context);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Platform.isIOS) {
|
|
var updata = {"old_version_ios": packageInfo.version};
|
|
final data = await VersionControl().storeCurrentVersion(updata);
|
|
if (data.status == cresponse.ResponseStatus.SUCCESS) {
|
|
final data1 = await VersionControl().getCurrentVersion();
|
|
if (data1.status == cresponse.ResponseStatus.SUCCESS) {
|
|
if (packageInfo.version != version!.result!.newVersionIos!) {
|
|
appUpdateDialog(context);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
appUpdateDialog(BuildContext context) async {
|
|
await Future.delayed(Duration(milliseconds: 10));
|
|
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false, // Disable tapping outside to dismiss
|
|
barrierColor: ColorConstants.kBlack.withOpacity(0.9),
|
|
builder: (BuildContext context) {
|
|
return WillPopScope(
|
|
onWillPop: () async {
|
|
// Prevent dialog dismissal on back button press
|
|
return true;
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: context.width * 0.05),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Color.fromARGB(255, 20, 20, 20),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 15,
|
|
vertical: 25,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Text("Update Available"),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
// children: [
|
|
// SizedBox(
|
|
// width: 30,
|
|
// ),
|
|
// Text("Update Available"),
|
|
// Spacer(),
|
|
// GestureDetector(
|
|
// onTap: () {
|
|
// Get.back();
|
|
// },
|
|
// child: Icon(Icons.close))
|
|
// ],
|
|
// ),
|
|
SizedBox(height: 20),
|
|
Text("A new version of the app is available"),
|
|
SizedBox(height: 25),
|
|
FullWdtBtn(
|
|
btnText: "Update",
|
|
onTap: () {
|
|
storeLauncher.launchStore();
|
|
}),
|
|
SizedBox(height: 25),
|
|
FullWdtBtn(
|
|
btnText: "Skip",
|
|
onTap: () {
|
|
Get.back();
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
initBackgroundProcess() async {
|
|
final androidConfig = FlutterBackgroundAndroidConfig(
|
|
shouldRequestBatteryOptimizationsOff: true,
|
|
showBadge: true,
|
|
notificationTitle: "GSF",
|
|
notificationText: "Recording step counts",
|
|
notificationImportance: AndroidNotificationImportance.High,
|
|
notificationIcon:
|
|
AndroidResource(name: 'background', defType: 'drawable'),
|
|
);
|
|
|
|
bool resp =
|
|
await FlutterBackground.initialize(androidConfig: androidConfig);
|
|
if (resp) {
|
|
await FlutterBackground.enableBackgroundExecution();
|
|
}
|
|
}
|
|
|
|
//pedometer module variables
|
|
late Stream<StepCount> _stepCountStream;
|
|
String _steps = '?';
|
|
// Initialize a step count variable and a date variable
|
|
int _appStepCount = 0;
|
|
DateTime _currentDate = DateTime.now();
|
|
Timer? _timer;
|
|
final calculateStepsFromHealthApp stepscontroller =
|
|
Get.put(calculateStepsFromHealthApp());
|
|
initiatePedometerModule() {
|
|
// if (Platform.isAndroid) {
|
|
// permissionDialog();
|
|
// getStepCountFromStorage();
|
|
// checkAndUpdateDate();
|
|
// }
|
|
if (Platform.isIOS) {
|
|
_startTimer();
|
|
}
|
|
}
|
|
|
|
void _startTimer() {
|
|
_timer = Timer.periodic(const Duration(seconds: 5), (timer) {
|
|
stepscontroller.fetchStepData();
|
|
});
|
|
_timer = Timer.periodic(const Duration(minutes: 10), (timer) {
|
|
stepscontroller.storeStepsInDB();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
aControllerFind.localWeight.value =
|
|
GetStorage().read('localWeight') ?? '- -';
|
|
aControllerFind.localMusclerate.value =
|
|
GetStorage().read('localMusclerate') ?? '- -';
|
|
aControllerFind.localbodyFat.value =
|
|
GetStorage().read('localbodyFat') ?? '- -';
|
|
aControllerFind.localSkeletalRate.value =
|
|
GetStorage().read('localSkeletalRate') ?? '- -';
|
|
aControllerFind.localProtein.value =
|
|
GetStorage().read('localProtein') ?? '- -';
|
|
|
|
aControllerFind.localBmr.value = GetStorage().read('localBmr') ?? '- -';
|
|
aControllerFind.localWater.value = GetStorage().read('localWater') ?? '- -';
|
|
aControllerFind.localAge.value = GetStorage().read('localAge') ?? '- -';
|
|
|
|
return Scaffold(
|
|
floatingActionButton:
|
|
Visibility(visible: showQuizbool, child: FlotingActionBtn()),
|
|
key: controller.scaffoldKey,
|
|
drawer: AppDrawer(),
|
|
appBar: AppBar(
|
|
automaticallyImplyLeading: false,
|
|
leading: InkWell(
|
|
key: appTourController.navDrawer,
|
|
onTap: controller.openDrawer,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8),
|
|
child: Obx(
|
|
() => Image.asset(
|
|
'assets/image/${(globalContoller.darkMode.value == false) ? 'menu_dark' : 'menu'}.png',
|
|
),
|
|
)),
|
|
),
|
|
// ),
|
|
actions: [
|
|
SizedBox(
|
|
child: (controller.isLoggedIn)
|
|
? Row(
|
|
children: [
|
|
Padding(
|
|
key: appTourController.notifications,
|
|
padding: EdgeInsets.all(4.0),
|
|
child: NotificationIcon(),
|
|
),
|
|
|
|
const SizedBox(width: 10),
|
|
Padding(
|
|
// key: appTourController.settings,
|
|
padding: const EdgeInsets.all(4),
|
|
child: InkWell(
|
|
splashColor: Color.fromARGB(0, 153, 112, 112),
|
|
onTap: () {
|
|
Get.to(
|
|
() => Settings(),
|
|
);
|
|
},
|
|
child: Icon(
|
|
Icons.settings_outlined,
|
|
color: ColorConstants.kWhite,
|
|
),
|
|
),
|
|
),
|
|
// ),
|
|
const SizedBox(width: 20),
|
|
],
|
|
)
|
|
: GestureDetector(
|
|
onTap: () => Get.off(
|
|
() => const SignIn(),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12),
|
|
child: Image.asset(
|
|
'assets/image/logout.png',
|
|
width: 30,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
body: showMoodOMeterAfterAppTour ?? false
|
|
? HomePageSkeleton()
|
|
: FutureBuilder(
|
|
future: bannerMoodOMeterFutureGroup
|
|
.future, //MoodOMeterService().getMoodOMeter(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
return Center(child: HomePageSkeleton());
|
|
} else if (snapshot.hasError) {
|
|
return Text('Error: ${snapshot.error}');
|
|
} else {
|
|
if (homeApiController.moodCheckResult == "1") {
|
|
moodOMeterDialog(context);
|
|
}
|
|
|
|
return AnimatedBuilder(
|
|
child: GestureDetector(
|
|
child: Obx(
|
|
() => SingleChildScrollView(
|
|
child: BannerContent(
|
|
bannerModel: ManageBannerModel(
|
|
bannerPath: appDataController.bannerPath.value,
|
|
bannerPosition:
|
|
appDataController.bannerPosition.value),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
animation: _animationController,
|
|
builder: (context, child) {
|
|
return FadeScaleTransition(
|
|
animation: _animationController,
|
|
child: child,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}),
|
|
bottomNavigationBar: BottomNavigation(),
|
|
);
|
|
}
|
|
|
|
rewardPointDialog(BuildContext context) async {
|
|
print(
|
|
'homeApiController.setMoodResponse.progressBar ${homeApiController.setMoodResponse.progressBar}');
|
|
await Future.delayed(Duration(milliseconds: 10));
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
barrierColor: ColorConstants.kBlack.withOpacity(0.9),
|
|
builder: (BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: context.width * 0.05),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Color.fromARGB(255, 20, 20, 20),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 15, vertical: 25),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
// Positioned(
|
|
// top: -80,
|
|
// left: 0,
|
|
// right: 0,
|
|
// child: Align(
|
|
// alignment: Alignment.center,
|
|
// child: Container(
|
|
// decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(100),
|
|
// ),
|
|
// width: 100,
|
|
// height: 100,
|
|
// child: appDataController.profilePicUrl.value.isEmpty
|
|
// ? CircleAvatar(
|
|
// backgroundColor: ColorConstants.kPrimaryColor,
|
|
// child: const Icon(
|
|
// Icons.person_rounded,
|
|
// size: 52,
|
|
// color: Colors.black,
|
|
// ),
|
|
// )
|
|
// : CircleAvatar(
|
|
// backgroundImage: NetworkImage(
|
|
// appDataController.profilePicUrl.value),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
|
|
Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Get.back();
|
|
},
|
|
child: Icon(
|
|
Icons.close,
|
|
color: ColorConstants.kPrimaryColor,
|
|
size: 25,
|
|
),
|
|
),
|
|
),
|
|
// const SizedBox(height: 30),
|
|
|
|
LottieBuilder.network(
|
|
"https://assets6.lottiefiles.com/packages/lf20_touohxv0.json",
|
|
// height: ,
|
|
height: 250,
|
|
width: 200,
|
|
),
|
|
|
|
Text(
|
|
"Congratulations",
|
|
style: TextStyle(
|
|
fontSize: 25,
|
|
color: ColorConstants.kPrimaryColor,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
|
|
Text(
|
|
// HomeApiController().setMoodResponse,
|
|
homeApiController.setMoodResponse.progressBar ?? "",
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: Color(0xffD9D9D9),
|
|
),
|
|
),
|
|
|
|
// TextSpan(
|
|
// text: appDataController.name.value,
|
|
// style: TextStyle(
|
|
// fontSize: 17,
|
|
// color: ColorConstants.kPrimaryColor,
|
|
// fontWeight: FontWeight.w500,
|
|
// ),
|
|
// )
|
|
|
|
// const SizedBox(height: 34),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
missionPossible(BuildContext context) {
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
barrierColor: ColorConstants.kBlack.withOpacity(0.9),
|
|
builder: (BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: context.width * 0.05),
|
|
child: FutureBuilder<ResponseModel>(
|
|
future: GetOurThoughts().getShareThoughtsData(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
ShareOurthoutghs shareThoughts = snapshot.data!.data;
|
|
final yourThoutghs = shareThoughts.userThoughts.split('-');
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: ColorConstants.kBlack,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 15, vertical: 25),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Positioned(
|
|
top: -80,
|
|
left: 0,
|
|
right: 0,
|
|
child: Align(
|
|
alignment: Alignment.center,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
width: 100,
|
|
height: 100,
|
|
child: Image.asset(
|
|
'assets/image/feedback_img/power.png',
|
|
fit: BoxFit.cover,
|
|
alignment: Alignment.center,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
const SizedBox(height: 56),
|
|
Text(
|
|
yourThoutghs[0],
|
|
style: TextStyle(
|
|
fontSize: 30,
|
|
color: ColorConstants.kWhite,
|
|
fontWeight: FontWeight.w500,
|
|
letterSpacing: 1.07,
|
|
),
|
|
),
|
|
Text(
|
|
yourThoutghs[1],
|
|
style: TextStyle(
|
|
fontSize: 42,
|
|
color: ColorConstants.kPrimaryColor,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: 3,
|
|
height: 1,
|
|
),
|
|
),
|
|
Text(
|
|
yourThoutghs[2],
|
|
style: TextStyle(
|
|
fontSize: 30,
|
|
color: ColorConstants.kWhite,
|
|
height: 1,
|
|
fontWeight: FontWeight.w500,
|
|
letterSpacing: 1.07,
|
|
),
|
|
),
|
|
const SizedBox(height: 35),
|
|
FullWdtBtn(
|
|
btnText: "Let's Go",
|
|
onTap: () {
|
|
// Get.back();
|
|
Get.back();
|
|
// rewa
|
|
rewardPointDialog(context);
|
|
// Get.to(
|
|
// );
|
|
|
|
// Get.offAll(
|
|
// () => ShowCaseWidget(
|
|
// builder: Builder(
|
|
// builder: (context) => const HomePage(),
|
|
// ),
|
|
// ),
|
|
// () => const HomePage(),
|
|
// );
|
|
},
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: const [
|
|
CircularProgressIndicator(),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
calculateMood(int index) async {
|
|
switch (index) {
|
|
case 0:
|
|
await MoodOMeterService().uploadMood("Very Happy");
|
|
break;
|
|
case 1:
|
|
await MoodOMeterService().uploadMood("Happy");
|
|
break;
|
|
case 2:
|
|
await MoodOMeterService().uploadMood("Ok");
|
|
break;
|
|
case 3:
|
|
await MoodOMeterService().uploadMood("Whatever");
|
|
break;
|
|
case 4:
|
|
await MoodOMeterService().uploadMood("Sad");
|
|
break;
|
|
default:
|
|
Get.snackbar(
|
|
'Error',
|
|
'Select something',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
backgroundColor: Colors.red,
|
|
colorText: Colors.white,
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
|
|
moodOMeterDialog(BuildContext context) async {
|
|
AppDataController appDataController = Get.find();
|
|
await Future.delayed(Duration(milliseconds: 10));
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
barrierColor: ColorConstants.kBlack.withOpacity(0.9),
|
|
builder: (BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: context.width * 0.05),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
color: Color.fromARGB(255, 20, 20, 20),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 15, vertical: 25),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Positioned(
|
|
top: -80,
|
|
left: 0,
|
|
right: 0,
|
|
child: Align(
|
|
alignment: Alignment.center,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
width: 100,
|
|
height: 100,
|
|
child: appDataController.profilePicUrl.value.isEmpty
|
|
? CircleAvatar(
|
|
child: const Icon(
|
|
Icons.person_rounded,
|
|
size: 52,
|
|
color: Colors.black,
|
|
),
|
|
backgroundColor: Colors.transparent,
|
|
)
|
|
: CircleAvatar(
|
|
backgroundImage: NetworkImage(
|
|
appDataController.profilePicUrl.value,
|
|
),
|
|
backgroundColor: Colors.transparent,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Column(
|
|
children: [
|
|
const SizedBox(height: 30),
|
|
RichText(
|
|
text: TextSpan(
|
|
children: [
|
|
TextSpan(
|
|
text: 'Hey ',
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: Color(0xffD9D9D9),
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
TextSpan(
|
|
text: appDataController.name.value,
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: ColorConstants.kPrimaryColor,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
const Text(
|
|
'How are you feeling?',
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: Color(0xffD9D9D9),
|
|
),
|
|
),
|
|
const SizedBox(height: 34),
|
|
MoodOMeter(
|
|
fromHomePage: true,
|
|
),
|
|
const SizedBox(height: 34),
|
|
FullWdtBtn(
|
|
btnText: 'Share your thoughts!',
|
|
onTap: () async {
|
|
if (activeIndexMoodOMeter == -1) {
|
|
Get.snackbar(
|
|
'Error',
|
|
'Select something',
|
|
snackPosition: SnackPosition.BOTTOM,
|
|
backgroundColor: Colors.red,
|
|
colorText: Colors.white,
|
|
);
|
|
} else {
|
|
await calculateMood(activeIndexMoodOMeter);
|
|
box.write('showMoodOmeter', false);
|
|
Get.back();
|
|
missionPossible(context);
|
|
// Get.to();
|
|
}
|
|
},
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
class BannerContent extends StatefulWidget {
|
|
final ManageBannerModel bannerModel;
|
|
const BannerContent({required this.bannerModel, Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<BannerContent> createState() => _BannerContentState();
|
|
}
|
|
|
|
class _BannerContentState extends State<BannerContent> {
|
|
final CarouselController _controller = CarouselController();
|
|
HomePageController homePageController = Get.put(HomePageController());
|
|
final TabsController controller = TabsController();
|
|
AnimationController? _animationController;
|
|
double textOpacity = 0.0;
|
|
int _current = 0;
|
|
late List<Widget> bannerContent;
|
|
var shortClipNLikesFutureGrp = FutureGroup();
|
|
|
|
final box = GetStorage();
|
|
RxBool showPodcast = true.obs;
|
|
List<dynamic> list = [
|
|
{
|
|
'img': 'assets/image/home_slider_img.png',
|
|
'headTxt': 'Killing Your Way to Achieve',
|
|
'subText': 'Summer Body!',
|
|
'btntxt': 'Start My 7 Days Free Trial',
|
|
},
|
|
{
|
|
'img': 'assets/image/home_slider_img.png',
|
|
'headTxt': 'Torch Those',
|
|
'subText': 'Calories',
|
|
'btntxt': 'Start My 7 Days Free Trial',
|
|
},
|
|
{
|
|
'img': 'assets/image/home_slider_img.png',
|
|
'headTxt': 'Get Fit',
|
|
'subText': 'With Us',
|
|
'btntxt': 'Start My 7 Days Free Trial',
|
|
}
|
|
];
|
|
|
|
var members =
|
|
memberDetails.map((e) => MeetTheCommunityModel.fromJson(e)).toList();
|
|
AppDataController appDataController = Get.find();
|
|
|
|
@override
|
|
void initState() {
|
|
var shortClipService = ShortClipService();
|
|
shortClipNLikesFutureGrp.add(shortClipService.fetchShortClips());
|
|
shortClipNLikesFutureGrp.add(shortClipService.fetchShortClipLikes());
|
|
shortClipNLikesFutureGrp.close();
|
|
|
|
super.initState();
|
|
// readThoutgh();
|
|
// box.read('showMoodOmeter') ?? true ? moodOMeterDialog(context) : null;
|
|
}
|
|
|
|
// readThoutgh() {
|
|
// if (moodOmeter) {
|
|
// moodOMeterDialog(context);
|
|
// }
|
|
// }
|
|
|
|
// bool get moodOmeter => box.read('showMoodOmeter') ?? true;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
bannerContent = [
|
|
sectionOne(),
|
|
sectionTwo(),
|
|
// sectionThree(),
|
|
sectionFour(),
|
|
sectionFive(),
|
|
sectionSix(),
|
|
sectionSeven(),
|
|
sectionPodcasts(),
|
|
//sectionEight(),
|
|
sectionNine()
|
|
];
|
|
bannerContent.remove(sectionThree(widget.bannerModel.bannerPath));
|
|
bannerContent.insert(widget.bannerModel.bannerPosition,
|
|
sectionThree(widget.bannerModel.bannerPath));
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: bannerContent,
|
|
);
|
|
}
|
|
|
|
Widget sectionOne() {
|
|
// final brightness = Get.theme.brightness;
|
|
GlobalController globalContoller = Get.find();
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(height: 10),
|
|
Obx(
|
|
() => Padding(
|
|
padding: const EdgeInsets.only(left: 20.0),
|
|
child: Text(
|
|
"Hey, " + appDataController.name.value,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kPrimaryColor,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w700,
|
|
// letterSpacing: 1,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Obx(
|
|
() => Padding(
|
|
padding: EdgeInsets.only(left: 20.0, top: 5),
|
|
child: Text(
|
|
'Let\'s Get Started!',
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w400,
|
|
// letterSpacing: 1.5,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
// sliderArea(),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionTwo() {
|
|
// final aControllerFind = Get.put(AController());
|
|
// bool isScaleAdd = GetStorage().read("addScale") ?? false;
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: loggedInSlider(),
|
|
),
|
|
const SizedBox(height: 20)
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionThree(String bannerUrl) {
|
|
final screenSize = MediaQuery.of(context).size;
|
|
// print('widget.bannerModel.bannerPath ${widget.bannerModel.bannerPath}');
|
|
return Column(
|
|
children: [
|
|
SizedBox(height: 20),
|
|
FadeInImage.assetNetwork(
|
|
placeholder: "assets/image/placeholder.jpg",
|
|
image: bannerUrl,
|
|
width: screenSize.width * 1,
|
|
fit: BoxFit.cover,
|
|
),
|
|
SizedBox(height: 20),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionFour() {
|
|
GlobalController globalContoller = Get.find();
|
|
// final brightness = Get.theme.brightness;
|
|
MyRankingController myRankingController = Get.put(MyRankingController());
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Obx(
|
|
() => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(height: 10),
|
|
Text(
|
|
'Community',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: Color(0xffffffff),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
Text(
|
|
'Leaderboard',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack.withOpacity(0.6)
|
|
: Color(0xffB7B7B7),
|
|
),
|
|
),
|
|
const SizedBox(height: 40),
|
|
FutureBuilder<ResponseModel>(
|
|
future: RankingLeaderboard().getLeaderBoardDataWithoutFilter(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
RnakingModel userRanking = snapshot.data!.data;
|
|
myRankingController.defaultGenderStore.value =
|
|
userRanking.gender;
|
|
myRankingController.defaultGroupLevelStore.value =
|
|
userRanking.groupLevel;
|
|
|
|
// print('userRanking ${userRanking.groupLevel}');
|
|
String generateGroupLevels() {
|
|
if (userRanking.groupLevel == "elites") {
|
|
groupLevelNameGlobal = "Swole";
|
|
return "Swole";
|
|
} else if (userRanking.groupLevel == "gameChangers") {
|
|
groupLevelNameGlobal = "Up Steppersle";
|
|
return "Up Steppers";
|
|
} else if (userRanking.groupLevel == "underdogs") {
|
|
groupLevelNameGlobal = "Rookie";
|
|
return "Rookie";
|
|
}
|
|
return "Swole";
|
|
}
|
|
|
|
myRankingController.groupLevel.value =
|
|
generateGroupLevels();
|
|
}
|
|
return SizedBox();
|
|
}),
|
|
FutureBuilder<ResponseModel>(
|
|
future:
|
|
RankingLeaderboard().getLeaderBoardDataWithoutFilterHome(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
RnakingModel userRanking = snapshot.data!.data;
|
|
return Obx(() => Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
// Index 0
|
|
userRanking.userData!.length >= 1
|
|
? GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(3),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Container(
|
|
width: Get.size.width * 0.26,
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(10),
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kWhite
|
|
: const Color(0xff333333),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ColorConstants.kBlack
|
|
.withOpacity(0.2),
|
|
offset: const Offset(
|
|
2.0,
|
|
2.0,
|
|
),
|
|
blurRadius: 10.0,
|
|
spreadRadius: 2.0,
|
|
)
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 12.0,
|
|
left: 12,
|
|
right: 12,
|
|
bottom: 10,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
// Image.asset(
|
|
// 'assets/image/1.png',
|
|
// fit: BoxFit.cover,
|
|
// ),
|
|
ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.circular(100),
|
|
child: (userRanking
|
|
.userData![0]
|
|
.userData!
|
|
.profilePicture !=
|
|
null &&
|
|
userRanking
|
|
.userData![0]
|
|
.userData!
|
|
.profilePicture!
|
|
.isNotEmpty)
|
|
? Image.network(
|
|
correctImgUrl(
|
|
'${userRanking.userData![0].userData!.profilePicture}'),
|
|
width: 60,
|
|
height: 60,
|
|
)
|
|
: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius
|
|
.circular(100),
|
|
child: Image.network(
|
|
'https://media.istockphoto.com/id/1327592449/vector/default-avatar-photo-placeholder-icon-grey-profile-picture-business-man.jpg?s=612x612&w=0&k=20&c=yqoos7g9jmufJhfkbQsk-mdhKEsih6Di4WZ66t_ib7I=',
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
Text(
|
|
userRanking
|
|
.userData![0].user!.fullName
|
|
.toUpperCase(),
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
fontFamily: 'SFPRO',
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
Text(
|
|
'${userRanking.userData![0].totalScore} Pt',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
.withOpacity(0.6)
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: -40,
|
|
right: -5,
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
left: 0,
|
|
child: Text(
|
|
'1',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? Colors.white
|
|
: ColorConstants
|
|
.kBlack),
|
|
),
|
|
),
|
|
Text(
|
|
'1',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
foreground: Paint()
|
|
..style = PaintingStyle.stroke
|
|
..strokeWidth = 1
|
|
..color = !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: SizedBox(
|
|
width: Get.size.width * 0.26,
|
|
),
|
|
// index 2
|
|
userRanking.userData!.length >= 2
|
|
? GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(3),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Container(
|
|
width: Get.size.width * 0.26,
|
|
decoration: BoxDecoration(
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kWhite
|
|
: const Color(0xff333333),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ColorConstants.kBlack
|
|
.withOpacity(0.2),
|
|
offset: const Offset(
|
|
2.0,
|
|
2.0,
|
|
),
|
|
blurRadius: 10.0,
|
|
spreadRadius: 2.0,
|
|
)
|
|
],
|
|
borderRadius:
|
|
BorderRadius.circular(10),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 12.0,
|
|
left: 12,
|
|
right: 12,
|
|
bottom: 10,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
// Image.asset(
|
|
// 'assets/image/1.png',
|
|
// fit: BoxFit.cover,
|
|
// ),
|
|
ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.circular(100),
|
|
child: (userRanking
|
|
.userData![1]
|
|
.userData!
|
|
.profilePicture !=
|
|
null &&
|
|
userRanking
|
|
.userData![1]
|
|
.userData!
|
|
.profilePicture!
|
|
.isNotEmpty)
|
|
? Image.network(
|
|
correctImgUrl(
|
|
'${userRanking.userData![1].userData!.profilePicture}'),
|
|
width: 60,
|
|
height: 60,
|
|
)
|
|
: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius
|
|
.circular(100),
|
|
child: Image.network(
|
|
'https://media.istockphoto.com/id/1327592449/vector/default-avatar-photo-placeholder-icon-grey-profile-picture-business-man.jpg?s=612x612&w=0&k=20&c=yqoos7g9jmufJhfkbQsk-mdhKEsih6Di4WZ66t_ib7I=',
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
Text(
|
|
userRanking
|
|
.userData![1].user!.fullName
|
|
.toUpperCase(),
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
fontFamily: 'SFPRO',
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
Text(
|
|
'${userRanking.userData![1].totalScore} Pt',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
.withOpacity(0.6)
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: -40,
|
|
right: -15,
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
child: Text(
|
|
'2',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? Colors.white
|
|
: ColorConstants
|
|
.kBlack),
|
|
),
|
|
),
|
|
Text(
|
|
'2',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
foreground: Paint()
|
|
..style = PaintingStyle.stroke
|
|
..strokeWidth = 1
|
|
..color = !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: SizedBox(
|
|
width: Get.size.width * 0.26,
|
|
),
|
|
// index 3
|
|
userRanking.userData!.length >= 3
|
|
? GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(3),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Container(
|
|
width: Get.size.width * 0.26,
|
|
decoration: BoxDecoration(
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kWhite
|
|
: const Color(0xff333333),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ColorConstants.kBlack
|
|
.withOpacity(0.2),
|
|
offset: const Offset(
|
|
2.0,
|
|
2.0,
|
|
),
|
|
blurRadius: 10.0,
|
|
spreadRadius: 2.0,
|
|
)
|
|
],
|
|
borderRadius:
|
|
BorderRadius.circular(10),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 12.0,
|
|
left: 12,
|
|
right: 12,
|
|
bottom: 10,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
// Image.asset(
|
|
// 'assets/image/1.png',
|
|
// fit: BoxFit.cover,
|
|
// ),
|
|
ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.circular(100),
|
|
child: (userRanking
|
|
.userData![2]
|
|
.userData!
|
|
.profilePicture !=
|
|
null &&
|
|
userRanking
|
|
.userData![2]
|
|
.userData!
|
|
.profilePicture
|
|
?.isNotEmpty !=
|
|
null)
|
|
? Image.network(
|
|
correctImgUrl(
|
|
'${userRanking.userData![2].userData!.profilePicture}'),
|
|
width: 60,
|
|
height: 60,
|
|
)
|
|
: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius
|
|
.circular(100),
|
|
child: Image.network(
|
|
'https://media.istockphoto.com/id/1327592449/vector/default-avatar-photo-placeholder-icon-grey-profile-picture-business-man.jpg?s=612x612&w=0&k=20&c=yqoos7g9jmufJhfkbQsk-mdhKEsih6Di4WZ66t_ib7I=',
|
|
width: 60,
|
|
height: 60,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
Text(
|
|
userRanking
|
|
.userData![2].user!.fullName
|
|
.toUpperCase(),
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
fontFamily: 'SFPRO',
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
Text(
|
|
'${userRanking.userData![2].totalScore} Pt',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
.withOpacity(0.6)
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
top: -40,
|
|
right: -15,
|
|
child: Stack(
|
|
children: [
|
|
Positioned(
|
|
child: Text(
|
|
'3',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? Colors.white
|
|
: ColorConstants.kBlack,
|
|
),
|
|
),
|
|
),
|
|
Text(
|
|
'3',
|
|
style: TextStyle(
|
|
fontSize: 64,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w800,
|
|
foreground: Paint()
|
|
..style = PaintingStyle.stroke
|
|
..strokeWidth = 1
|
|
..color = !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: SizedBox(
|
|
width: Get.size.width * 0.26,
|
|
),
|
|
],
|
|
));
|
|
}
|
|
return SizedBox(
|
|
height: 124,
|
|
child: ListView.builder(
|
|
itemCount: 3,
|
|
shrinkWrap: true,
|
|
scrollDirection: Axis.horizontal,
|
|
itemBuilder: (context, index) {
|
|
return SkeletonAvatar(
|
|
style: SkeletonAvatarStyle(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
width: Get.width / 3.8,
|
|
height: 120,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(height: 30),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
child: FullWdtBtn(
|
|
// styleElement: TextStyle(fontSize: 15),
|
|
btnText: 'View Leaderboard',
|
|
onTap: () => homePageController.updateBottomNavIndex(3),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget sectionFive() {
|
|
// GlobalController globalContoller = Get.find();
|
|
// final screenSize = MediaQuery.of(context).size;
|
|
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: headWithArrow(
|
|
'Upcoming Live Activities',
|
|
() {
|
|
HomePageController.SessionsActiveTabIndex = 1;
|
|
homePageController.updateBottomNavIndex(1);
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
UpcomingSession(),
|
|
const SizedBox(height: 20),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionSix() {
|
|
GlobalController globalContoller = Get.find();
|
|
final screenSize = MediaQuery.of(context).size;
|
|
bool isScaleStablized = GetStorage().read("scaleStablized") ?? false;
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Obx(
|
|
() => Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: Text(
|
|
'Personalised Nutrition Plan',
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
fontFamily: 'SFPRO',
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 15),
|
|
Stack(
|
|
children: [
|
|
Image.asset(
|
|
'assets/image/dietbg.jpeg',
|
|
width: screenSize.width * 1,
|
|
fit: BoxFit.cover,
|
|
),
|
|
Positioned(
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 20,
|
|
child: Column(
|
|
children: [
|
|
const Text(
|
|
'Is Your Food Helping You?',
|
|
style: TextStyle(
|
|
color: ColorConstants.kWhite,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
fontFamily: 'SFPRO',
|
|
letterSpacing: 0.5,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
SizedBox(
|
|
width: 250,
|
|
child: FullWdtBtn(
|
|
btnText: 'View Meal Plan',
|
|
onTap: () {
|
|
isScaleStablized
|
|
? Get.to(() => DietChartPlan())
|
|
: homePageController.updateBottomNavIndex(2);
|
|
},
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 20),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionSeven() {
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 22.0),
|
|
child: headWithArrow(
|
|
'Bites',
|
|
() => Get.to(
|
|
() => InstaClips(),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
// FutureBuilder<List<ShortClipModel>>(
|
|
// future: ShortClipService().fetchShortClips(),
|
|
// builder: (context, snapshot) {
|
|
// if (snapshot.connectionState == ConnectionState.done &&
|
|
// snapshot.hasData) {
|
|
// return HomePageShortClipsList(clips: snapshot.data!);
|
|
// }
|
|
// return HomePageShortVideosShimmer();
|
|
// },
|
|
// ),
|
|
|
|
FutureBuilder<List>(
|
|
future: shortClipNLikesFutureGrp.future,
|
|
builder: (context, snapshot) {
|
|
// print("hjkdgjhfskdjhfjkdhs ${snapshot.data}");
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
ShortClipTemp.tempClips = snapshot.data![0];
|
|
ShortClipTemp.tempclipLikes = snapshot.data![1];
|
|
|
|
// print("kdfslndfsdsf ${][0].isLiked}");
|
|
for (ShortClipLikesModel m in snapshot.data![1]) {}
|
|
|
|
if (snapshot.data![0].isNotEmpty) {
|
|
return HomePageShortClipsList(
|
|
clips: snapshot.data![0],
|
|
shortClipLikesModel: snapshot.data![1],
|
|
);
|
|
}
|
|
return VideosNotFound();
|
|
}
|
|
return HomePageShortVideosShimmer();
|
|
},
|
|
),
|
|
const SizedBox(height: 30),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionNine() {
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 22.0),
|
|
child: Column(
|
|
children: [
|
|
meetTheCommunity(),
|
|
const SizedBox(height: 10),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget sectionPodcasts() {
|
|
return Obx(
|
|
() {
|
|
return Visibility(
|
|
visible: showPodcast.value,
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 22.0),
|
|
child: headWithArrow(
|
|
'Podcasts',
|
|
() => Get.to(
|
|
() => PodcastMain(),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
// FutureBuilder<List<ShortClipModel>>(
|
|
// future: ShortClipService().fetchShortClips(),
|
|
// builder: (context, snapshot) {
|
|
// if (snapshot.connectionState == ConnectionState.done &&
|
|
// snapshot.hasData) {
|
|
// return HomePageShortClipsList(clips: snapshot.data!);
|
|
// }
|
|
// return HomePageShortVideosShimmer();
|
|
// },
|
|
// ),
|
|
|
|
FutureBuilder(
|
|
future: PodcastApis().getPodcasts(),
|
|
builder: (context, snapshot) {
|
|
// print("hjkdgjhfskdjhfjkdhs ${snapshot.data}");
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
if (pods!.result!.latestPodcast!.isEmpty) {
|
|
Future.delayed(Duration(seconds: 1),
|
|
() => showPodcast.value = false);
|
|
}
|
|
return SizedBox(
|
|
height: 170,
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: pods?.result?.latestPodcast?.length ?? 0,
|
|
itemBuilder: (context, index) => GestureDetector(
|
|
onTap: () {
|
|
Get.to(() => PodcastAudioPalyer());
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 10, right: 8),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(100),
|
|
child: SizedBox(
|
|
width: 94,
|
|
height: 94,
|
|
child: Image.network(
|
|
pods!.result!.latestPodcast![index]
|
|
.bannerImage!,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
pods!.result!.latestPodcast![index].title!,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xffFFFFFF),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Image.asset('assets/image/music.png'),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
// const Text(
|
|
// '0.30 Min',
|
|
// style: TextStyle(
|
|
// fontSize: 10,
|
|
// color: ColorConstants.kWhite,
|
|
// ),
|
|
// )
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
return HomePageShortVideosShimmer();
|
|
},
|
|
),
|
|
const SizedBox(height: 30),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget courses() {
|
|
GlobalController globalContoller = Get.find();
|
|
return SizedBox(
|
|
height: 120,
|
|
child: ListView.builder(
|
|
itemCount: 12,
|
|
scrollDirection: Axis.horizontal,
|
|
itemBuilder: (context, index) => OpenContainerWrappers(
|
|
openBuild: CoursesOverview(),
|
|
closeBuild: Obx(
|
|
() => Container(
|
|
margin: EdgeInsets.only(right: 20),
|
|
width: Get.width * 0.36,
|
|
// height: 200,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(4),
|
|
child: Image.asset(
|
|
'assets/image/courses/fitness.jpg',
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
'Healthy with GSF',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kPrimaryColor,
|
|
fontFamily: 'SFPRO',
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget sliderArea() {
|
|
final screenSize = Get.mediaQuery.size;
|
|
return StatefulBuilder(builder: (context, setSliderState) {
|
|
return Column(
|
|
children: [
|
|
CarouselSlider(
|
|
carouselController: _controller,
|
|
options: CarouselOptions(
|
|
height: 400,
|
|
viewportFraction: 1.0,
|
|
autoPlay: true,
|
|
enableInfiniteScroll: false,
|
|
// autoPlayCurve: Curves.linear,
|
|
autoPlayInterval: const Duration(seconds: 3),
|
|
onPageChanged: (index, reason) {
|
|
// setState(() {
|
|
// _current = index;
|
|
// });
|
|
setSliderState(
|
|
() {
|
|
_current = index;
|
|
},
|
|
);
|
|
}),
|
|
items: list
|
|
.map(
|
|
(item) => Container(
|
|
width: screenSize.width * 1,
|
|
height: 400,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
item['img'],
|
|
),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Container(
|
|
width: 62,
|
|
height: 62,
|
|
decoration: BoxDecoration(
|
|
color: ColorConstants.kPrimaryColor,
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
child: InkWell(
|
|
// onTap: (() => Get.to(() => const VimeoPlayer())),
|
|
child: const Icon(
|
|
Icons.play_arrow,
|
|
size: 40,
|
|
color: ColorConstants.kBlack,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 40),
|
|
Text(
|
|
item['headTxt'],
|
|
style: const TextStyle(
|
|
fontSize: 26,
|
|
color: Color(0xffE9E9E9),
|
|
),
|
|
),
|
|
Text(
|
|
item['subText'],
|
|
style: const TextStyle(
|
|
fontSize: 26,
|
|
color: Color(0xffE9E9E9),
|
|
fontWeight: FontWeight.bold,
|
|
letterSpacing: 1,
|
|
),
|
|
),
|
|
const SizedBox(height: 30),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 50, right: 50, bottom: 30),
|
|
child: FullWdtBtn(
|
|
btnText: (controller.isLoggedIn)
|
|
? 'Explore Now'
|
|
: item['btntxt'],
|
|
onTap: () {},
|
|
styleElement: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
)
|
|
.toList(),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: list.asMap().entries.map((entry) {
|
|
return GestureDetector(
|
|
onTap: () => _controller.animateToPage(entry.key),
|
|
child: Container(
|
|
width: 15,
|
|
height: 2,
|
|
margin: const EdgeInsets.symmetric(
|
|
vertical: 6.0, horizontal: 2.0),
|
|
decoration: BoxDecoration(
|
|
// shape: BoxShape.circle,
|
|
color: (_current == entry.key
|
|
? ColorConstants.kPrimaryColor
|
|
: const Color(0xff858585)),
|
|
),
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
],
|
|
);
|
|
});
|
|
}
|
|
|
|
Widget meetTheCommunity() {
|
|
final screenSize = Get.mediaQuery.size;
|
|
// final brightness = Get.theme.brightness;
|
|
GlobalController globalContoller = Get.find();
|
|
return SizedBox(
|
|
height: 210,
|
|
// width: screenSize.width * 1,
|
|
child: FutureBuilder<MeetTheCommunityModel>(
|
|
future: MeetTheCommunityService().fetchCommunityData(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
// print('snapshot.data ${snapshot.data}');
|
|
// print('image data ${snapshot.data![0].user}');
|
|
|
|
return Column(
|
|
children: [
|
|
headWithArrow('Meet the Community', () {
|
|
Get.to(
|
|
() => CommunityMember(
|
|
communityModel: snapshot.data!.user!,
|
|
),
|
|
);
|
|
}),
|
|
const SizedBox(height: 10),
|
|
Expanded(
|
|
child: ListView.builder(
|
|
shrinkWrap: true,
|
|
scrollDirection: Axis.horizontal,
|
|
padding: const EdgeInsets.all(0),
|
|
physics: const BouncingScrollPhysics(),
|
|
itemCount: snapshot.data!.user!.length,
|
|
itemBuilder: (context, index) {
|
|
return GestureDetector(
|
|
// onTap: () => bottomSheetDesc(snapshot.data![index]),
|
|
onTap: () => Get.to(() => CommunityMember(
|
|
communityModel: snapshot.data!.user!,
|
|
)),
|
|
child: Obx(
|
|
() => Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 35.0, right: 10, top: 00),
|
|
child: Container(
|
|
width: screenSize.width * 0.7,
|
|
decoration: BoxDecoration(
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack.withOpacity(0.1)
|
|
: const Color(0xff191919),
|
|
borderRadius: BorderRadius.circular(11),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
child: Stack(
|
|
clipBehavior: Clip.none,
|
|
children: [
|
|
Positioned(
|
|
top: 0,
|
|
left: -50,
|
|
child: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.circular(12),
|
|
child: Image.network(
|
|
"https://thegsf.co/public/uploads/testimonial/${snapshot.data!.user![index].testimonialData!.first.images}",
|
|
width: 100,
|
|
height: 150,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.start,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: SizedBox(),
|
|
flex: 1,
|
|
),
|
|
Expanded(
|
|
flex: 5,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 20.0),
|
|
child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
snapshot.data!
|
|
.user![index].title
|
|
.toString(),
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants
|
|
.kBlack
|
|
: ColorConstants
|
|
.kPrimaryColor,
|
|
),
|
|
maxLines: 2,
|
|
overflow:
|
|
TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 5),
|
|
// SizedBox(
|
|
// height: 20,
|
|
// child: ListView.builder(
|
|
// itemCount: 5,
|
|
// scrollDirection:
|
|
// Axis.horizontal,
|
|
// itemBuilder:
|
|
// (context, index1) {
|
|
// if (index1 <
|
|
// snapshot.data![index]
|
|
// .rating!) {
|
|
// return Icon(
|
|
// Icons.star,
|
|
// size: 18,
|
|
// color: (brightness ==
|
|
// Brightness
|
|
// .light)
|
|
// ? ColorConstants
|
|
// .kBlack
|
|
// : ColorConstants
|
|
// .kPrimaryColor,
|
|
// );
|
|
// } else {
|
|
// return Icon(
|
|
// Icons.star_outline,
|
|
// size: 18,
|
|
// color:
|
|
// Color(0xff8D8D8D),
|
|
// );
|
|
// }
|
|
// },
|
|
// ),
|
|
// ),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
snapshot
|
|
.data!
|
|
.user![index]
|
|
.description
|
|
.toString(),
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants
|
|
.kBlack
|
|
: Color(0xffD9D9D9),
|
|
height: 1.3,
|
|
),
|
|
maxLines: 3,
|
|
overflow:
|
|
TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
snapshot.data!
|
|
.user![index].userName
|
|
.toString(),
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: !globalContoller
|
|
.darkMode.value
|
|
? ColorConstants
|
|
.kBlack
|
|
: ColorConstants
|
|
.kWhite,
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
),
|
|
maxLines: 2,
|
|
overflow:
|
|
TextOverflow.ellipsis,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
));
|
|
},
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
return meetTheCommunityLoader();
|
|
}),
|
|
);
|
|
}
|
|
|
|
meetTheCommunityLoader() {
|
|
return SizedBox(
|
|
height: 180,
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
shrinkWrap: true,
|
|
itemCount: 3,
|
|
physics: const ScrollPhysics(),
|
|
itemBuilder: (context, index) => SizedBox(
|
|
width: Get.width * 0.95,
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: SkeletonAvatar(
|
|
style: SkeletonAvatarStyle(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
width: Get.width,
|
|
height: 170,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 4,
|
|
child: Column(
|
|
children: [
|
|
SkeletonParagraph(
|
|
style: SkeletonParagraphStyle(
|
|
lines: 1,
|
|
spacing: 10,
|
|
lineStyle: SkeletonLineStyle(
|
|
randomLength: true,
|
|
height: 15,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
SkeletonParagraph(
|
|
style: SkeletonParagraphStyle(
|
|
lines: 3,
|
|
spacing: 10,
|
|
lineStyle: SkeletonLineStyle(
|
|
randomLength: true,
|
|
height: 15,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
SkeletonParagraph(
|
|
style: SkeletonParagraphStyle(
|
|
lines: 1,
|
|
spacing: 10,
|
|
lineStyle: SkeletonLineStyle(
|
|
randomLength: true,
|
|
height: 15,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
bottomSheetDesc(data) {
|
|
return showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
builder: (context) => ClipRRect(
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(20),
|
|
topRight: Radius.circular(20),
|
|
),
|
|
child: Container(
|
|
decoration: const BoxDecoration(
|
|
color: ColorConstants.kBlack,
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(25.0),
|
|
topRight: Radius.circular(25.0),
|
|
),
|
|
),
|
|
height: Get.height * 0.85,
|
|
child: SingleChildScrollView(
|
|
physics: const BouncingScrollPhysics(),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Image.network(
|
|
'${data.img}',
|
|
fit: BoxFit.cover,
|
|
height: 250,
|
|
width: Get.width,
|
|
),
|
|
const SizedBox(height: 20),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
'${data.title}',
|
|
style: const TextStyle(
|
|
fontSize: 16, color: ColorConstants.kPrimaryColor),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: SizedBox(
|
|
height: 20,
|
|
child: ListView.builder(
|
|
itemCount: 5,
|
|
scrollDirection: Axis.horizontal,
|
|
itemBuilder: (context, index1) {
|
|
if (index1 < data.rating!) {
|
|
return const Icon(
|
|
Icons.star,
|
|
size: 18,
|
|
color: ColorConstants.kPrimaryColor,
|
|
);
|
|
} else {
|
|
return const Icon(
|
|
Icons.star_outline,
|
|
size: 18,
|
|
color: Color(0xff8D8D8D),
|
|
);
|
|
}
|
|
},
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
data.desc,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
color: Color(0xffD9D9D9),
|
|
height: 1.3,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Text(
|
|
'${data.memberName}',
|
|
style: const TextStyle(
|
|
fontSize: 16,
|
|
color: ColorConstants.kWhite,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget headWithArrow(String head, VoidCallback ontap) {
|
|
GlobalController globalContoller = Get.find();
|
|
// final brightness = Get.theme.brightness;
|
|
return Obx(
|
|
() => Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
head,
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: Color(0xffD9D9D9),
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: ontap,
|
|
child: Icon(
|
|
Icons.keyboard_arrow_right,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kWhite,
|
|
size: 30,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget loggedInSlider() {
|
|
final aControllerFind = Get.put(AController());
|
|
// final brightnes = Get.theme.brightness;
|
|
GlobalController globalContoller = Get.find();
|
|
// final screenSize = Get.mediaQuery.size;
|
|
final brightness = Get.theme.brightness;
|
|
// String? weightRangeTxt;
|
|
// String? bmrRangeTxt;
|
|
String? mRangeTxt;
|
|
String? waterRangeTxt;
|
|
String? bodyfatRangeTxt;
|
|
// int? weightRangeClr;
|
|
int? waterRangeClr;
|
|
int? bodyFatRangeClr;
|
|
// int? bmrRangeClr;
|
|
int? mrRangeClr;
|
|
|
|
bool isScaleStablized = GetStorage().read("scaleStablized") ?? false;
|
|
double mrPercentage = double.parse(
|
|
(aControllerFind.localMusclerate.value == '- -')
|
|
? '0.0'
|
|
: aControllerFind.localMusclerate.value);
|
|
|
|
// BMR rate calculation range
|
|
double bmrPercentage = double.parse(
|
|
(aControllerFind.localBmr.value == '- -')
|
|
? '0.0'
|
|
: aControllerFind.localBmr.value,
|
|
);
|
|
|
|
// body fate rate calculation range
|
|
double bodyFatPercentage = double.parse(
|
|
(aControllerFind.localbodyFat.value == '- -')
|
|
? '0.0'
|
|
: aControllerFind.localbodyFat.value,
|
|
);
|
|
|
|
// water calculation range
|
|
double wPercentage = double.parse(
|
|
(aControllerFind.localWater.value == '- -')
|
|
? '0.0'
|
|
: aControllerFind.localWater.value);
|
|
|
|
String gender = appDataController.gender.toString();
|
|
// calculate bodFat start here
|
|
// print('body fat local data ${bodyFatPercentage}');
|
|
if (gender == 'male') {
|
|
if (bodyFatPercentage <= 10) {
|
|
bodyfatRangeTxt =
|
|
((aControllerFind.localbodyFat.value == '- -') ? '- -' : 'Low');
|
|
bodyFatRangeClr = 0xFFF44336;
|
|
} else if (bodyFatPercentage > 10 && bodyFatPercentage <= 21) {
|
|
bodyfatRangeTxt = 'Standard';
|
|
bodyFatRangeClr = 0xffFFFE00;
|
|
} else if (bodyFatPercentage > 21 && bodyFatPercentage <= 26) {
|
|
bodyfatRangeTxt = 'High';
|
|
bodyFatRangeClr = 0xFF8ED34A;
|
|
} else if (bodyFatPercentage > 26 && bodyFatPercentage <= 100) {
|
|
bodyfatRangeTxt = 'Too High';
|
|
bodyFatRangeClr = 0xFFF44336;
|
|
}
|
|
} else if (gender == 'female') {
|
|
if (bodyFatPercentage <= 10) {
|
|
bodyfatRangeTxt =
|
|
((aControllerFind.localbodyFat.value == '- -') ? '- -' : 'Low');
|
|
bodyFatRangeClr = 0xFFF44336;
|
|
} else if (bodyFatPercentage > 10 && bodyFatPercentage <= 21) {
|
|
bodyfatRangeTxt = 'Standard';
|
|
bodyFatRangeClr = 0xffFFFE00;
|
|
} else if (bodyFatPercentage > 21 && bodyFatPercentage <= 26) {
|
|
bodyfatRangeTxt = 'High';
|
|
bodyFatRangeClr = 0xFF8ED34A;
|
|
} else if (bodyFatPercentage > 26 && bodyFatPercentage <= 100) {
|
|
bodyfatRangeTxt = 'Too High';
|
|
bodyFatRangeClr = 0xFFF44336;
|
|
}
|
|
}
|
|
|
|
// muscle rate range calculation
|
|
if (gender == 'male') {
|
|
if (mrPercentage <= 60) {
|
|
mRangeTxt =
|
|
(aControllerFind.localMusclerate.value == '- -') ? '- -' : 'Low';
|
|
mrRangeClr = 0xFFF44336;
|
|
} else if (mrPercentage > 60 && mrPercentage <= 74) {
|
|
mRangeTxt = 'Standard';
|
|
mrRangeClr = 0xffFFFE00;
|
|
} else if (mrPercentage > 74 && mrPercentage <= 100) {
|
|
mRangeTxt = 'Excellent';
|
|
mrRangeClr = 0xFF8ED34A;
|
|
}
|
|
} else if (gender == 'female') {
|
|
if (mrPercentage >= 0 && mrPercentage <= 56) {
|
|
mRangeTxt =
|
|
(aControllerFind.localMusclerate.value == '- -') ? '- -' : 'Low';
|
|
mrRangeClr = 0xFFF44336;
|
|
} else if (mrPercentage > 56 && mrPercentage <= 70) {
|
|
mRangeTxt = 'Standard';
|
|
mrRangeClr = 0xffFFFE00;
|
|
} else if (mrPercentage > 70 && mrPercentage <= 100) {
|
|
mRangeTxt = 'Excellent';
|
|
mrRangeClr = 0xFF8ED34A;
|
|
}
|
|
}
|
|
|
|
// water rate range calculation
|
|
if (gender == 'male') {
|
|
if (wPercentage <= 55.00) {
|
|
waterRangeTxt =
|
|
(aControllerFind.localWater.value == '- -') ? '- -' : 'Low';
|
|
waterRangeClr = 0xFFF44336;
|
|
} else if (wPercentage > 55.00 && wPercentage <= 65.00) {
|
|
waterRangeTxt = 'Standard';
|
|
waterRangeClr = 0xffFFFE00;
|
|
} else if (wPercentage > 65.00 && wPercentage <= 100) {
|
|
waterRangeTxt = 'Excellent';
|
|
waterRangeClr = 0xFF8ED34A;
|
|
}
|
|
} else if (gender == 'female') {
|
|
if (wPercentage <= 46.00) {
|
|
waterRangeTxt =
|
|
(aControllerFind.localWater.value == '- -') ? '- -' : 'Low';
|
|
waterRangeClr = 0xFFF44336;
|
|
} else if (wPercentage > 46.00 && wPercentage <= 60.00) {
|
|
waterRangeTxt = 'Standard';
|
|
waterRangeClr = 0xffFFFE00;
|
|
} else if (wPercentage > 60.00 && wPercentage <= 100) {
|
|
waterRangeTxt = 'Excellent';
|
|
waterRangeClr = 0xFF8ED34A;
|
|
}
|
|
}
|
|
|
|
Timer.periodic(
|
|
Duration(milliseconds: 360),
|
|
(timer) {
|
|
textOpacity = 1.0;
|
|
timer.cancel();
|
|
},
|
|
);
|
|
|
|
return FutureBuilder<ResponseModel>(
|
|
future: RankingLeaderboard().getLeaderBoardRankPositions(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.done &&
|
|
snapshot.hasData) {
|
|
SelfRankPositions data = snapshot.data!.data;
|
|
appDataController.selfPosition.value = data.dailyPosition;
|
|
return isScaleStablized
|
|
? Obx(() => Container(
|
|
decoration: BoxDecoration(
|
|
color: !globalContoller.darkMode.value
|
|
? Colors.white
|
|
: const Color(0xff212121),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ColorConstants.kBlack.withOpacity(0.2),
|
|
offset: const Offset(
|
|
2.0,
|
|
2.0,
|
|
),
|
|
blurRadius: 10.0,
|
|
spreadRadius: 2.0,
|
|
),
|
|
],
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
|
child: Column(
|
|
children: [
|
|
Obx(
|
|
() => Text(
|
|
'You are at',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: !globalContoller.darkMode.value
|
|
? ColorConstants.kBlack
|
|
: Color(0xffD9D9D9),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10),
|
|
GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(3),
|
|
child: Text(
|
|
'${appDataController.selfPosition.value}',
|
|
style: TextStyle(
|
|
fontSize: 60,
|
|
color: (brightness == Brightness.light)
|
|
? ColorConstants.kBlack
|
|
: ColorConstants.kPrimaryColor,
|
|
height: 1,
|
|
),
|
|
),
|
|
),
|
|
Text(
|
|
'Global',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
color: (brightness == Brightness.light)
|
|
? ColorConstants.kBlack
|
|
: Color(0xffD9D9D9),
|
|
height: 1,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 4,
|
|
child: Column(
|
|
children: [
|
|
LayoutBuilder(
|
|
builder:
|
|
(context, BoxConstraints constraints) {
|
|
double maxWidth = constraints.maxWidth;
|
|
print(bmrPercentage * 100);
|
|
return GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(2),
|
|
child: Stack(
|
|
alignment: Alignment.centerRight,
|
|
children: [
|
|
Container(
|
|
width: maxWidth,
|
|
height: 25,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xffE3E4EA),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft: Radius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
|
|
//progress 1
|
|
TweenAnimationBuilder(
|
|
tween: Tween(
|
|
begin: 0,
|
|
end: (((bodyFatPercentage *
|
|
100) /
|
|
maxWidth) /
|
|
100) *
|
|
maxWidth),
|
|
duration: Duration(seconds: 1),
|
|
builder: (context, value, child) =>
|
|
Container(
|
|
width: double.parse(
|
|
value.toString(),
|
|
),
|
|
height: 25,
|
|
alignment: Alignment.centerRight,
|
|
decoration: BoxDecoration(
|
|
color: Color(bodyFatRangeClr!),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft:
|
|
Radius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(
|
|
horizontal: 8.0),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment
|
|
.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Body Fat',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
),
|
|
),
|
|
Text(
|
|
'$bodyfatRangeTxt ${bodyFatPercentage.round()} %',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight:
|
|
FontWeight.w600,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(height: 20),
|
|
LayoutBuilder(builder:
|
|
(context, BoxConstraints constraints) {
|
|
double maxWidth = constraints.maxWidth;
|
|
return GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(2),
|
|
child: Stack(
|
|
alignment: Alignment.centerRight,
|
|
children: [
|
|
Container(
|
|
width: maxWidth,
|
|
height: 25,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xffE3E4EA),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft: Radius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
|
|
//progress 2
|
|
TweenAnimationBuilder(
|
|
tween: Tween(
|
|
begin: 0,
|
|
end: (mrPercentage / 100) *
|
|
maxWidth),
|
|
duration: Duration(seconds: 1),
|
|
builder: (context, value, child) =>
|
|
Container(
|
|
width:
|
|
double.parse(value.toString()),
|
|
height: 25,
|
|
alignment: Alignment.centerRight,
|
|
decoration: BoxDecoration(
|
|
color: Color(mrRangeClr!),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft: Radius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
Positioned(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8.0),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment
|
|
.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Muscle Rate',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
Text(
|
|
'$mRangeTxt ${mrPercentage.round()} %',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
const SizedBox(height: 20),
|
|
LayoutBuilder(builder:
|
|
(context, BoxConstraints constraints) {
|
|
double maxWidth = constraints.maxWidth;
|
|
return GestureDetector(
|
|
onTap: () => homePageController
|
|
.updateBottomNavIndex(2),
|
|
child: Stack(
|
|
alignment: Alignment.centerRight,
|
|
children: [
|
|
Container(
|
|
width: maxWidth,
|
|
height: 25,
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xffE3E4EA),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft: Radius.circular(12),
|
|
),
|
|
),
|
|
),
|
|
|
|
//progress 3
|
|
TweenAnimationBuilder(
|
|
tween: Tween(
|
|
begin: 0,
|
|
end: (wPercentage / 100) *
|
|
maxWidth),
|
|
duration: Duration(seconds: 1),
|
|
builder: (context, value, child) =>
|
|
Container(
|
|
width:
|
|
double.parse(value.toString()),
|
|
height: 25,
|
|
alignment: Alignment.centerRight,
|
|
decoration: BoxDecoration(
|
|
color: Color(waterRangeClr!),
|
|
borderRadius: BorderRadius.only(
|
|
topLeft: Radius.circular(12),
|
|
bottomLeft: Radius.circular(12),
|
|
),
|
|
),
|
|
// child: AnimatedOpacity(
|
|
// duration: Duration(seconds: 1),
|
|
// opacity: textOpacity,
|
|
// child: Padding(
|
|
// padding: const EdgeInsets.only(right: 8.0),
|
|
// child: Text(
|
|
// wPercentage.toStringAsFixed(2),
|
|
// style: const TextStyle(
|
|
// fontSize: 12,
|
|
// color: Color(0xff000000),
|
|
// fontWeight: FontWeight.w600,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
),
|
|
),
|
|
Positioned(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8.0),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment
|
|
.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Water',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
Text(
|
|
'$waterRangeTxt ${wPercentage.round()} %',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xff000000),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
// const SizedBox(height: 20),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// Row(
|
|
// children: [
|
|
// Container(
|
|
// width: 16,
|
|
// height: 16,
|
|
// decoration: BoxDecoration(
|
|
// color: Color(0xff000000),
|
|
// borderRadius: BorderRadius.circular(100),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(width: 5),
|
|
// Text(
|
|
// 'BMR',
|
|
// style: TextStyle(
|
|
// fontSize: 11,
|
|
// color: (brightness == Brightness.light)
|
|
// ? ColorConstants.kBlack
|
|
// : Color(0xffD9D9D9),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// Container(
|
|
// width: 16,
|
|
// height: 16,
|
|
// decoration: BoxDecoration(
|
|
// color: Color(mrRangeClr!),
|
|
// borderRadius: BorderRadius.circular(100),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(width: 5),
|
|
// Text(
|
|
// 'Muscle Rate',
|
|
// style: TextStyle(
|
|
// fontSize: 11,
|
|
// color: (brightness == Brightness.light)
|
|
// ? ColorConstants.kBlack
|
|
// : Color(0xffD9D9D9),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// Container(
|
|
// width: 16,
|
|
// height: 16,
|
|
// decoration: BoxDecoration(
|
|
// color: Color(waterRangeClr!),
|
|
// borderRadius: BorderRadius.circular(100),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(width: 5),
|
|
// Text(
|
|
// 'Water',
|
|
// style: TextStyle(
|
|
// fontSize: 11,
|
|
// color: (brightness == Brightness.light)
|
|
// ? ColorConstants.kBlack
|
|
// : Color(0xffD9D9D9),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// const SizedBox(),
|
|
// ],
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
))
|
|
: Obx(
|
|
() => Container(
|
|
height: 150,
|
|
padding: EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: !globalContoller.darkMode.value
|
|
? Colors.white
|
|
: const Color(0xff212121),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: ColorConstants.kBlack.withOpacity(0.2),
|
|
offset: const Offset(2.0, 2.0),
|
|
blurRadius: 10.0,
|
|
spreadRadius: 2.0,
|
|
),
|
|
],
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Center(
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
homePageController.updateBottomNavIndex(2);
|
|
},
|
|
child: Text(
|
|
// 'No Data Found\nPlease use scale and get the health report.',
|
|
'Connect your Scale from the Bioscale tab.\n Or tap Here to connect your scale.',
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
return SkeletonAvatar(
|
|
style: SkeletonAvatarStyle(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
width: context.width,
|
|
height: 170,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
_animationController?.dispose();
|
|
}
|
|
}
|
|
|
|
class HomePageShortVideosShimmer extends StatelessWidget {
|
|
HomePageShortVideosShimmer({Key? key}) : super(key: key);
|
|
final list = [
|
|
SizedBox(width: 22),
|
|
// Shimmer.fromColors(
|
|
// child: const ShortClipElementSkeleton(),
|
|
// baseColor: const Color.fromARGB(255, 26, 26, 26),
|
|
// highlightColor: const Color.fromARGB(255, 40, 40, 40),
|
|
// ),
|
|
// Shimmer.fromColors(
|
|
// child: const ShortClipElementSkeleton(),
|
|
// baseColor: const Color.fromARGB(255, 26, 26, 26),
|
|
// highlightColor: const Color.fromARGB(255, 40, 40, 40),
|
|
// ),
|
|
// Shimmer.fromColors(
|
|
// child: const ShortClipElementSkeleton(),
|
|
// baseColor: const Color.fromARGB(255, 26, 26, 26),
|
|
// highlightColor: const Color.fromARGB(255, 40, 40, 40),
|
|
// ),
|
|
SizedBox(width: 22),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 210,
|
|
child: ListView.builder(
|
|
physics: NeverScrollableScrollPhysics(),
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: list.length,
|
|
itemBuilder: (context, index) {
|
|
return list[index];
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomePageShortClipsList extends StatelessWidget {
|
|
const HomePageShortClipsList({
|
|
required this.clips,
|
|
required this.shortClipLikesModel,
|
|
Key? key,
|
|
}) : super(key: key);
|
|
|
|
final List<ShortClipModel> clips;
|
|
final List<ShortClipLikesModel> shortClipLikesModel;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 210,
|
|
// padding: EdgeInsets.symmetric(horizontal: 20),
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: clips.length + 1,
|
|
itemBuilder: (context, index) {
|
|
if (index == 0) {
|
|
return SizedBox(width: 20);
|
|
} else {
|
|
return Padding(
|
|
padding:
|
|
EdgeInsets.only(right: index == clips.length ? 20 - 2.6 : 0),
|
|
child: ShortClipElement(
|
|
imgUrl: clips[index - 1].thumbnailUrl,
|
|
title: clips[index - 1].title,
|
|
onClick: () {
|
|
Get.to(() => SvpMain(fromHome: false, index: index - 1));
|
|
},
|
|
),
|
|
);
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|