diff --git a/lib/main.dart b/lib/main.dart index 7256612..6f1c738 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,6 +18,8 @@ class MyApp extends StatelessWidget { create: (context) => ThemeProvider(), builder: (context, _) { final themeProvider = Provider.of(context); + themeProvider.toggleTheme(!themeProvider.isDarkMode); + themeProvider.toggleTheme(!themeProvider.isDarkMode); return MaterialApp( scrollBehavior: AppScrollBehavior(), @@ -81,6 +83,7 @@ class _HomeViewState extends State { } Widget _body() { + ThemeData _themeData = Theme.of(context); return SafeArea( child: Container( // width: 1280, @@ -97,25 +100,25 @@ class _HomeViewState extends State { ), for (CustomListTile listTile in listTileList) ListTile( - leading: Icon(listTile.iconData), - title: Text(listTile.title), - subtitle: Text('Version: ${listTile.version}'), + leading: Icon(listTile.iconData, color: _themeData.textTheme.titleMedium?.color), + title: Text(listTile.title, style: _themeData.textTheme.titleMedium), + subtitle: Text('Version: ${listTile.version}', style: _themeData.textTheme.titleSmall), onTap: () { setState(() { Navigator.of(context).pushNamed(listTile.route); }); }, - trailing: Icon(Icons.arrow_forward), + trailing: Icon(Icons.arrow_forward, color: _themeData.textTheme.titleMedium?.color), ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Divider(), ), ListTile( - leading: Icon(Icons.assistant), - trailing: Icon(Icons.launch), - title: Text('Upcoming'), - subtitle: Text('...'), + leading: Icon(Icons.assistant, color: _themeData.textTheme.titleMedium?.color), + trailing: Icon(Icons.launch, color: _themeData.textTheme.titleMedium?.color), + title: Text('Upcoming', style: _themeData.textTheme.titleMedium), + subtitle: Text('...', style: _themeData.textTheme.titleSmall), onTap: () { setState(() { _launchUrl(Uri.parse('https://lucianojung.medium.com/')); diff --git a/lib/packages/custom_carousel/custom_carousel_main.dart b/lib/packages/custom_carousel/custom_carousel_main.dart index f87e807..d3b94f6 100644 --- a/lib/packages/custom_carousel/custom_carousel_main.dart +++ b/lib/packages/custom_carousel/custom_carousel_main.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; @@ -177,8 +176,8 @@ class _CustomCarouselState extends State { max: 1, divisions: 20, labels: RangeLabels( - _flipH.start.toStringAsFixed(1).toString(), - _flipH.end.toStringAsFixed(1).toString(), + '${(_flipH.start * 10).roundToDouble() / 10}', + '${(_flipH.end * 10).roundToDouble() / 10}', ), onChanged: (newRange) { setState(() { @@ -192,8 +191,8 @@ class _CustomCarouselState extends State { max: 1, divisions: 20, labels: RangeLabels( - _flipV.start.toStringAsFixed(1).toString(), - _flipV.end.toStringAsFixed(1).toString(), + '${(_flipV.start * 10).roundToDouble() / 10}', + '${(_flipV.end * 10).roundToDouble() / 10}', ), onChanged: (newRange) { setState(() { @@ -241,8 +240,8 @@ class _CustomCarouselState extends State { max: 1, divisions: 20, labels: RangeLabels( - _slideX.start.toStringAsFixed(1).toString(), - _slideX.end.toStringAsFixed(1).toString(), + '${(_slideX.start * 10).roundToDouble() / 10}', + '${(_slideX.end * 10).roundToDouble() / 10}', ), onChanged: (newRange) { setState(() { @@ -256,8 +255,8 @@ class _CustomCarouselState extends State { max: 5, divisions: 50, labels: RangeLabels( - _slideY.start.toStringAsFixed(1).toString(), - _slideY.end.toStringAsFixed(1).toString(), + '${(_slideY.start * 10).roundToDouble() / 10}', + '${(_slideY.end * 10).roundToDouble() / 10}', ), onChanged: (newRange) { setState(() { diff --git a/lib/packages/url_launcher/url_launcher_main.dart b/lib/packages/url_launcher/url_launcher_main.dart index ee2c9b3..5e04c78 100644 --- a/lib/packages/url_launcher/url_launcher_main.dart +++ b/lib/packages/url_launcher/url_launcher_main.dart @@ -250,20 +250,20 @@ class _UrlLauncherState extends State { } void _launchUrl(String url) async { - if (await canLaunch(url)) { + if (await canLaunchUrl(Uri.parse(url))) { if (!_isWebUrl) - launch(url); + launchUrl(Uri.parse(url)); else - launch( - url, - forceSafariVC: _forceSafarieVC, - forceWebView: _forceWebView, - enableJavaScript: _javaScriptEnabled, - enableDomStorage: _enableDomStorage, - universalLinksOnly: _universalLinksOnly, + launchUrl( + Uri.parse(url), + // forceSafariVC: _forceSafarieVC, + // forceWebView: _forceWebView, + // enableJavaScript: _javaScriptEnabled, + // enableDomStorage: _enableDomStorage, + // universalLinksOnly: _universalLinksOnly, webOnlyWindowName: _webOnlyWindowName ? '_self' : '_blank', - statusBarBrightness: _statusBarBrigthness ? Brightness.dark : Brightness.light, - headers: (_sendHeaderInfos) ? _headers : {} + // statusBarBrightness: _statusBarBrigthness ? Brightness.dark : Brightness.light, + // headers: (_sendHeaderInfos) ? _headers : {} ); } else { throw 'Could not launch $url'; diff --git a/lib/service/MyTheme.dart b/lib/service/MyTheme.dart index 17677ff..8b1d847 100644 --- a/lib/service/MyTheme.dart +++ b/lib/service/MyTheme.dart @@ -17,6 +17,9 @@ class MyTheme { static TextStyle _blackTextStyle = TextStyle(color: Colors.black); static TextStyle _black54TextStyle = TextStyle(color: Colors.black54); static TextStyle _black87TextStyle = TextStyle(color: Colors.black87); + static TextStyle _whiteTextStyle = TextStyle(color: Colors.white); + static TextStyle _white54TextStyle = TextStyle(color: Colors.white54); + static TextStyle _white70TextStyle = TextStyle(color: Colors.white70); static final lightTheme = ThemeData.light().copyWith( primaryColor: _mainColor, @@ -38,6 +41,18 @@ class MyTheme { static final darkTheme = ThemeData.dark().copyWith( primaryColor: _mainColor, + textTheme: TextTheme( + displayLarge: _whiteTextStyle, + displayMedium: _whiteTextStyle, + displaySmall: _whiteTextStyle, + headlineMedium: _whiteTextStyle, + headlineSmall: _whiteTextStyle, + titleLarge: _whiteTextStyle, + bodyLarge: _white54TextStyle, + bodyMedium: _white54TextStyle, + titleMedium: _white70TextStyle, + titleSmall: _white70TextStyle, + ), appBarTheme: _appBarTheme, colorScheme: ColorScheme.fromSwatch().copyWith(secondary: _secondaryColor), ); diff --git a/test/widget_test.dart b/test/widget_test.dart index 1a04a02..c358a7a 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -5,7 +5,6 @@ // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart';