Skip to content

Commit

Permalink
Feature Addition: About Section in Settings (#145)
Browse files Browse the repository at this point in the history
* About Section Added

* Fixing project structure

* Correction

* Get view

---------

Co-authored-by: Rijuth Menon <[email protected]>
  • Loading branch information
andoriyaprashant and MarkisDev authored Nov 26, 2023
1 parent 5616f1b commit 4e49af1
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/images/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions lib/app/modules/About/bindings/about_binding.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:get/get.dart';
import 'package:ultimate_alarm_clock/app/modules/about/controller/about_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart';

class AboutBinding extends Bindings {
@override
void dependencies() {
Get.put<AboutController>(
AboutController(),
);
Get.put<ThemeController>(
ThemeController(),
);
}
}
26 changes: 26 additions & 0 deletions lib/app/modules/About/controller/about_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:get/get.dart';
import 'package:ultimate_alarm_clock/app/modules/about/views/about_view.dart';
import 'package:url_launcher/url_launcher.dart';

class AboutController extends GetxController {
final RxBool isAboutExpanded = true.obs;

static const String ccExtractorUrl = "https://ccextractor.org/";
static const String githubUrl = "https://github.com/CCExtractor/ultimate_alarm_clock";

Future<bool> launchUrl(Uri uri) async {
if (await canLaunch(uri.toString())) {
return await launch(uri.toString());
} else {
return false;
}
}

void toggleAboutExpansion() {
isAboutExpanded.value = !isAboutExpanded.value;
}

void navigateToAboutView() {
Get.to(() => AboutView());
}
}
123 changes: 123 additions & 0 deletions lib/app/modules/About/views/about_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:ultimate_alarm_clock/app/modules/about/controller/about_controller.dart';

class AboutView extends GetView<AboutController> {
final AboutController aboutController = Get.find<AboutController>();

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('About'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(20),
child: SizedBox.fromSize(
size: Size.fromRadius(48),
child: Image.asset('assets/images/ic_launcher-playstore.png'),
),
),
SizedBox(height: 10),
Text(
'Ultimate Alarm Clock',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Text(
'Version: 1.0.0',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Text(
'This project aims to build a non-conventional alarm clock with smart features such as auto-dismissal based on phone activity, weather, and more!',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Colors.grey,
),
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: 160,
height: 40,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
), backgroundColor: Colors.white,
),
onPressed: () async {
if (!await aboutController.launchUrl(Uri.parse(AboutController.githubUrl))) {
throw Exception('Could not launch ${AboutController.githubUrl}');
}
},
icon: SvgPicture.asset(
"assets/images/github.svg",
width: 30,
height: 30,
),
label: Text(
"GitHub",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
fontSize: 12,
),
),
),
),
SizedBox(
width: 160,
height: 40,
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
), backgroundColor: Colors.white,
),
onPressed: () async {
if (!await aboutController.launchUrl(Uri.parse(AboutController.ccExtractorUrl))) {
throw Exception('Could not launch ${AboutController.ccExtractorUrl}');
}
},
icon: SvgPicture.asset(
"assets/images/link.svg",
width: 30,
height: 30,
),
label: Text(
"CCExtractor",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.w500,
fontSize: 12,
),
),
),
),
],
),
],
),
),
);
}
}
58 changes: 58 additions & 0 deletions lib/app/modules/settings/views/about.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:ultimate_alarm_clock/app/modules/about/controller/about_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart';
import 'package:ultimate_alarm_clock/app/utils/constants.dart';

class AboutSection extends StatelessWidget {
const AboutSection({
Key? key,
required this.aboutController,
required this.width,
required this.height,
required this.themeController,
}) : super(key: key);

final AboutController aboutController;
final ThemeController themeController;
final double width;
final double height;

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
aboutController.navigateToAboutView();
},
child: Container(
width: width * 0.91,
height: height * 0.1,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(18),
),
color: themeController.isLightMode.value
? kLightSecondaryBackgroundColor
: ksecondaryBackgroundColor,
),
child: Padding(
padding: EdgeInsets.only(left: 30, right: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'About',
style: Theme.of(context).textTheme.bodyLarge,
),
Icon(
Icons.arrow_forward_ios_sharp,
color: themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.4)
: kprimaryTextColor.withOpacity(0.2),
),
],
),
),
),
);
}
}
14 changes: 14 additions & 0 deletions lib/app/modules/settings/views/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:ultimate_alarm_clock/app/modules/home/controllers/home_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/about/controller/about_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart';

import 'package:ultimate_alarm_clock/app/modules/settings/views/about.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/views/custom_ringtone.dart';

import 'package:ultimate_alarm_clock/app/modules/settings/views/enable_haptic_feedback.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/views/enable_sorted_alarm_list.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/views/theme_value_tile.dart';
Expand All @@ -18,6 +22,7 @@ class SettingsView extends GetView<SettingsController> {

HomeController homeController = Get.find<HomeController>();
ThemeController themeController = Get.find<ThemeController>();
AboutController aboutController = Get.put(AboutController());

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -106,6 +111,15 @@ class SettingsView extends GetView<SettingsController> {
width: width,
themeController: themeController,
),
const SizedBox(
height: 20,
),
AboutSection(
aboutController: aboutController,
height: height,
width: width,
themeController: themeController,
),
],
),
),
Expand Down
9 changes: 9 additions & 0 deletions lib/app/routes/app_pages.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:get/get.dart';
import 'package:ultimate_alarm_clock/app/modules/about/bindings/about_binding.dart';
import 'package:ultimate_alarm_clock/app/modules/about/views/about_view.dart';
import 'package:ultimate_alarm_clock/app/modules/splashScreen/bindings/splash_screen_binding.dart';
import 'package:ultimate_alarm_clock/app/modules/splashScreen/views/splash_screen_view.dart';

Expand Down Expand Up @@ -63,5 +65,12 @@ class AppPages {
page: () => AlarmChallengeView(),
binding: AlarmChallengeBinding(),
),
//AboutView
GetPage(
name: _Paths.ABOUT,
page: () => AboutView(),
binding: AboutBinding(),
),

];
}
2 changes: 2 additions & 0 deletions lib/app/routes/app_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ abstract class Routes {
static const ALARM_RING_IGNORE = _Paths.ALARM_RING_IGNORE;
static const SETTINGS = _Paths.SETTINGS;
static const ALARM_CHALLENGE = _Paths.ALARM_CHALLENGE;
static const ABOUT = _Paths.ABOUT;
}

abstract class _Paths {
Expand All @@ -21,4 +22,5 @@ abstract class _Paths {
static const ALARM_RING_IGNORE = '/alarm-ring-ignore';
static const SETTINGS = '/settings';
static const ALARM_CHALLENGE = '/alarm-challenge';
static const ABOUT = '/about';
}

0 comments on commit 4e49af1

Please sign in to comment.