diff --git a/lib/common.dart b/lib/common.dart index 0136097..50c3412 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -5,8 +5,7 @@ import 'word_page.dart'; const String APP_NAME = "Auslan Dictionary"; -// const Color MAIN_COLOR = Colors.blue; -// const Color APP_BAR_DISABLED_COLOR = Color.fromARGB(94, 0, 0, 0); +const MaterialColor MAIN_COLOR = Colors.blue; const String IOS_APP_ID = "1531368368"; const String ANDROID_APP_ID = "com.banool.auslan_dictionary"; diff --git a/lib/flashcards_landing_page.dart b/lib/flashcards_landing_page.dart index b1ccc4e..36ea607 100644 --- a/lib/flashcards_landing_page.dart +++ b/lib/flashcards_landing_page.dart @@ -114,22 +114,20 @@ class MyFlashcardsLandingPageController await showDialog( context: context, builder: (ctx) { - return MultiSelectDialog( - listType: MultiSelectListType.CHIP, - title: - Text(DictLibLocalizations.of(context)!.flashcardsRegions), - items: regionsWithoutEverywhere - .map((e) => MultiSelectItem(e.index, e.pretty)) - .toList(), - initialValue: additionalRegionsValues, - onConfirm: (values) { - setState(() { - sharedPreferences.setStringList(KEY_FLASHCARD_REGIONS, - values.map((e) => e.toString()).toList()); - updateRevisionSettings(); + return buildMultiSelectDialog( + context: context, + title: DictLibLocalizations.of(context)!.flashcardsRegions, + items: regionsWithoutEverywhere + .map((e) => MultiSelectItem(e.index, e.pretty)) + .toList(), + initialValue: additionalRegionsValues, + onConfirm: (values) { + setState(() { + sharedPreferences.setStringList(KEY_FLASHCARD_REGIONS, + values.map((e) => e.toString()).toList()); + updateRevisionSettings(); + }); }); - }, - ); }, ); }, diff --git a/lib/flashcards_page.dart b/lib/flashcards_page.dart index 774a17c..8616489 100644 --- a/lib/flashcards_page.dart +++ b/lib/flashcards_page.dart @@ -219,7 +219,7 @@ class FlashcardsPageState extends State { Widget buildFlashcardWidget(DRCard card, SubEntry subEntry, String word, bool wordToSign, bool revealed) { - ColorScheme currentTheme = Theme.of(context).colorScheme; + ColorScheme colorScheme = Theme.of(context).colorScheme; var shouldUseHorizontalDisplay = getShouldUseHorizontalLayout(context); // See here for an explanation of why I pass in a key here: @@ -300,11 +300,10 @@ class FlashcardsPageState extends State { if (states.contains(WidgetState.disabled)) { return Colors.grey; } else { - return currentTheme.primary; + return colorScheme.primaryContainer; } }, ), - foregroundColor: WidgetStateProperty.all(Colors.white), ), onPressed: () async { await Navigator.push( diff --git a/lib/root.dart b/lib/root.dart index a3ea019..3672bec 100644 --- a/lib/root.dart +++ b/lib/root.dart @@ -145,16 +145,12 @@ class _RootAppState extends State { debugShowCheckedModeBanner: false, themeMode: themeMode, theme: ThemeData( - brightness: Brightness.light, - primarySwatch: Colors.blue, - // Use ColorScheme to define primary and secondary colors - colorScheme: ColorScheme.fromSwatch( - primarySwatch: Colors.blue, - ).copyWith( - secondary: Colors.blue, + colorScheme: ColorScheme.fromSeed( + seedColor: MAIN_COLOR, + brightness: Brightness.light, ), appBarTheme: const AppBarTheme( - backgroundColor: Colors.blue, + backgroundColor: MAIN_COLOR, foregroundColor: Colors.white, elevation: 0, ), @@ -168,7 +164,7 @@ class _RootAppState extends State { ), typography: Typography.material2021( colorScheme: ColorScheme.fromSeed( - seedColor: Colors.blue, brightness: Brightness.light)), + seedColor: MAIN_COLOR, brightness: Brightness.light)), textButtonTheme: TextButtonThemeData( style: ButtonStyle( foregroundColor: WidgetStatePropertyAll(Colors.black), @@ -180,17 +176,17 @@ class _RootAppState extends State { (Set states) => states.contains(WidgetState.disabled) ? Colors.black38 - : Colors.white, + : Colors.black, ), ), ), // Update InputDecoration theme for search field underline and placeholder inputDecorationTheme: const InputDecorationTheme( focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.blue), + borderSide: BorderSide(color: MAIN_COLOR), ), enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.blue), + borderSide: BorderSide(color: MAIN_COLOR), ), hintStyle: TextStyle(color: Colors.black54), ), @@ -207,13 +203,14 @@ class _RootAppState extends State { ), ), snackBarTheme: SnackBarThemeData( - backgroundColor: Colors.blue, + backgroundColor: MAIN_COLOR, contentTextStyle: TextStyle(color: Colors.white), ), // Update BottomNavigationBar theme bottomNavigationBarTheme: const BottomNavigationBarThemeData( - selectedItemColor: Colors.blue, + selectedItemColor: MAIN_COLOR, unselectedItemColor: Colors.grey, + backgroundColor: Colors.white, ), visualDensity: VisualDensity.adaptivePlatformDensity, pageTransitionsTheme: const PageTransitionsTheme(builders: { @@ -222,14 +219,9 @@ class _RootAppState extends State { }), ), darkTheme: ThemeData( - brightness: Brightness.dark, - primarySwatch: Colors.blue, - // Use ColorScheme to define primary and secondary colors - colorScheme: ColorScheme.fromSwatch( - primarySwatch: Colors.blue, + colorScheme: ColorScheme.fromSeed( + seedColor: MAIN_COLOR, brightness: Brightness.dark, - ).copyWith( - secondary: Colors.blue, ), appBarTheme: const AppBarTheme( backgroundColor: Color(0xFF1F1F1F), @@ -246,7 +238,7 @@ class _RootAppState extends State { ), typography: Typography.material2021( colorScheme: ColorScheme.fromSeed( - seedColor: Colors.blue, brightness: Brightness.dark)), + seedColor: MAIN_COLOR, brightness: Brightness.dark)), // Update TextButton theme textButtonTheme: TextButtonThemeData( style: ButtonStyle( @@ -266,10 +258,10 @@ class _RootAppState extends State { // Update InputDecoration theme for search field underline and placeholder inputDecorationTheme: const InputDecorationTheme( focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.blue), + borderSide: BorderSide(color: MAIN_COLOR), ), enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.blue), + borderSide: BorderSide(color: MAIN_COLOR), ), hintStyle: TextStyle(color: Colors.white60), ), @@ -286,13 +278,14 @@ class _RootAppState extends State { ), ), snackBarTheme: SnackBarThemeData( - backgroundColor: Colors.blue, + backgroundColor: MAIN_COLOR, contentTextStyle: TextStyle(color: Colors.black), ), // Update BottomNavigationBar theme bottomNavigationBarTheme: const BottomNavigationBarThemeData( - selectedItemColor: Colors.blue, + selectedItemColor: MAIN_COLOR, unselectedItemColor: Colors.grey, + backgroundColor: Color(0xFF121212), ), visualDensity: VisualDensity.adaptivePlatformDensity, pageTransitionsTheme: const PageTransitionsTheme(builders: { diff --git a/lib/word_page.dart b/lib/word_page.dart index 3f31a64..69b9b85 100644 --- a/lib/word_page.dart +++ b/lib/word_page.dart @@ -173,6 +173,19 @@ class _EntryPageState extends State { Widget? getRelatedEntriesWidget(BuildContext context, MySubEntry subEntry, bool shouldUseHorizontalDisplay) { + return getInnerRelatedEntriesWidget( + context: context, + subEntry: subEntry, + shouldUseHorizontalDisplay: shouldUseHorizontalDisplay, + getRelatedEntry: (keyword) => + keyedByEnglishEntriesGlobal.containsKey(keyword) + ? keyedByEnglishEntriesGlobal[keyword] + : null, + navigateToEntryPage: (context, entry, showFavouritesButton) => + navigateToEntryPage(context, entry, showFavouritesButton)); + + ColorScheme colorScheme = Theme.of(context).colorScheme; + int numKeywords = subEntry.keywords.length; if (numKeywords == 0) { return null; @@ -199,14 +212,18 @@ Widget? getRelatedEntriesWidget(BuildContext context, MySubEntry subEntry, } textSpans.add(TextSpan( text: "$keyword$suffix", - style: TextStyle(), + style: TextStyle( + color: colorScheme.onSurface, + ), recognizer: TapGestureRecognizer()..onTap = navFunction, )); idx += 1; } - var initial = const TextSpan( - text: "Related words: ", style: TextStyle(fontWeight: FontWeight.bold)); + var initial = TextSpan( + text: "Related words: ", + style: + TextStyle(color: colorScheme.onSurface, fontWeight: FontWeight.bold)); textSpans = [initial] + textSpans; var richText = RichText( text: TextSpan(children: textSpans), diff --git a/pubspec.lock b/pubspec.lock index 39cd0ee..62f00b8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -211,10 +211,10 @@ packages: description: path: "." ref: main - resolved-ref: "5ce15cd83af0a403f327898239dea97aa5ebe65d" + resolved-ref: d8a3f16cd7ee913642e43fb683f47d1031458f3b url: "https://github.com/banool/dictionarylib.git" source: git - version: "0.2.6" + version: "0.2.8" dolphinsr_dart: dependency: "direct main" description: @@ -533,12 +533,13 @@ packages: source: hosted version: "1.15.0" multi_select_flutter: - dependency: "direct main" + dependency: transitive description: - name: multi_select_flutter - sha256: "503857b415d390d29159df8a9d92d83c6aac17aaf1c307fb7bcfc77d097d20ed" - url: "https://pub.dev" - source: hosted + path: "." + ref: master + resolved-ref: "6581736ca3db116b90a7750c51c2c01187179cdb" + url: "https://github.com/erickgon92/multi_select_flutter" + source: git version: "4.1.3" octo_image: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index babe00f..7e83fc0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Free video dictionary of Auslan signs publish_to: 'none' -version: 1.17.3+787 +version: 1.17.5+789 environment: sdk: '>=2.18.0 <3.0.0' @@ -32,7 +32,6 @@ dependencies: http: launch_review: mailto: - multi_select_flutter: package_info_plus: path_provider: shared_preferences: