diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index de608cc..0507bcf 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -44,5 +44,17 @@ + + + + + + + + + + + + diff --git a/lib/features/meditation/presentation/pages/meditation_page.dart b/lib/features/meditation/presentation/pages/meditation_page.dart index 1560d0f..283ade0 100644 --- a/lib/features/meditation/presentation/pages/meditation_page.dart +++ b/lib/features/meditation/presentation/pages/meditation_page.dart @@ -324,9 +324,12 @@ class _MeditationPageState extends State { @override void dispose() { - dataSources!.clear(); - __chartData!.clear(); - _annotationSources!.clear(); + try { + dataSources!.clear(); + __chartData!.clear(); + _annotationSources!.clear(); + }catch(error){} + super.dispose(); } diff --git a/lib/features/meditation/presentation/pages/settingscreen.dart b/lib/features/meditation/presentation/pages/settingscreen.dart index 88f2143..369eb18 100644 --- a/lib/features/meditation/presentation/pages/settingscreen.dart +++ b/lib/features/meditation/presentation/pages/settingscreen.dart @@ -5,10 +5,34 @@ import 'package:mental_health/core/theme.dart'; import 'package:mental_health/features/auth/domain/entities/auth/googleapisignin.dart'; import 'package:mental_health/features/meditation/presentation/pages/generalSettings/fieldUpdates.dart'; import 'package:mental_health/presentation/onboarding/onboarding.dart'; +import 'package:url_launcher/url_launcher.dart'; -class SettingScreen extends StatelessWidget { +class SettingScreen extends StatefulWidget { const SettingScreen({super.key}); + @override + State createState() => _SettingScreenState(); +} + +class _SettingScreenState extends State { + + Future? _launched; + + @override + void initState() { + super.initState(); + } + + Future _launchInAppWithBrowserOptions(Uri url) async { + if (!await launchUrl( + url, + mode: LaunchMode.inAppBrowserView, + browserConfiguration: const BrowserConfiguration(showTitle: true), + )) { + throw Exception('Could not launch $url'); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -16,13 +40,6 @@ class SettingScreen extends StatelessWidget { backgroundColor: DefaultColors.white, elevation: 10, shadowColor: Colors.black, - // leading: Container( - // decoration: const BoxDecoration( - // image: DecorationImage( - // image: AssetImage('assets/essentials/back.png'), - // ), - // ), - // ), title: Padding( padding: const EdgeInsets.all(20.0), child: Row( @@ -148,15 +165,26 @@ class SettingScreen extends StatelessWidget { const SizedBox( width: 10, ), - const SizedBox( - width: 200, - child: Text( - 'Data Storage', - style: TextStyle( - color: Colors.black, - fontSize: 20, - fontFamily: 'Inter', - height: 0, + GestureDetector( + onTap: (){ + + final Uri toLaunch = + Uri(scheme: 'https', host: 'www.postgresql.org',path: '/'); + setState(() { + _launched = _launchInAppWithBrowserOptions(toLaunch); + }); + }, + + child: const SizedBox( + width: 200, + child: Text( + 'Data Storage', + style: TextStyle( + color: Colors.black, + fontSize: 20, + fontFamily: 'Inter', + height: 0, + ), ), ), ), @@ -181,15 +209,25 @@ class SettingScreen extends StatelessWidget { const SizedBox( width: 10, ), - const SizedBox( - width: 200, - child: Text( - 'API Integrations', - style: TextStyle( - color: Colors.black, - fontSize: 20, - fontFamily: 'Inter', - height: 0, + GestureDetector( + onTap: (){ + + final Uri toLaunch = + Uri(scheme: 'https', host: 'docs.llama-api.com',path: '/essentials/chat'); + setState(() { + _launched = _launchInAppWithBrowserOptions(toLaunch); + }); + }, + child: const SizedBox( + width: 200, + child: Text( + 'API Integrations', + style: TextStyle( + color: Colors.black, + fontSize: 20, + fontFamily: 'Inter', + height: 0, + ), ), ), ), @@ -482,7 +520,7 @@ class SettingScreen extends StatelessWidget { const SizedBox( width: 200, child: Text( - 'Clear Logs', + 'Clear Cache', style: TextStyle( color: Colors.black, fontSize: 20, diff --git a/pubspec.lock b/pubspec.lock index badf2e0..09d709d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1186,6 +1186,70 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" + url: "https://pub.dev" + source: hosted + version: "6.3.12" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af + url: "https://pub.dev" + source: hosted + version: "3.2.0" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + url: "https://pub.dev" + source: hosted + version: "3.1.2" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 36368c6..21180d9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: hive: hive_flutter: syncfusion_flutter_charts: + url_launcher: dev_dependencies: flutter_test: sdk: flutter