-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature Addition: About Section in Settings (#145)
* About Section Added * Fixing project structure * Correction * Get view --------- Co-authored-by: Rijuth Menon <[email protected]>
- Loading branch information
1 parent
5616f1b
commit 4e49af1
Showing
9 changed files
with
249 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters