Skip to content

Commit

Permalink
Bug fixes for expandable and marquee visual bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arianneorpilla committed Apr 6, 2023
1 parent fb39ca9 commit 3270e4f
Show file tree
Hide file tree
Showing 14 changed files with 332 additions and 200 deletions.
7 changes: 7 additions & 0 deletions yuuna/lib/src/creator/anki_mapping.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,11 @@ class AnkiMapping {

return actions;
}

@override
bool operator ==(Object other) =>
other is AnkiMapping && label == other.label;

@override
int get hashCode => label.hashCode;
}
10 changes: 7 additions & 3 deletions yuuna/lib/src/dictionary/dictionary_utils.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import 'package:yuuna/dictionary.dart';
import 'package:yuuna/i18n/strings.g.dart';
Expand Down Expand Up @@ -345,9 +346,12 @@ Future<void> depositDictionaryDataHelper(PrepareDictionaryParams params) async {
// debugPrint('Collisions Found: $collisionsFound');
});
}
} catch (e, stackTrace) {
params.send(stackTrace);
params.send(e);
} catch (e, stack) {
debugPrint('$e');
debugPrint('$stack');

params.send('$e');

rethrow;
}
}
Expand Down
9 changes: 7 additions & 2 deletions yuuna/lib/src/models/app_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,12 @@ class AppModel with ChangeNotifier {

/// Persist a new last selected model name. This is called when the user
/// changes the selected model to map in the profiles menu.
Future<void> setLastSelectedMapping(AnkiMapping mapping) async {
Future<void> setLastSelectedMapping(AnkiMapping mapping,
{bool notify = true}) async {
await _preferences.put('last_selected_mapping', mapping.label);
notifyListeners();
if (notify) {
notifyListeners();
}
}

/// Get the current home tab index. The order of the tab indexes are based on
Expand Down Expand Up @@ -1228,6 +1231,8 @@ class AppModel with ChangeNotifier {
initialModel: initialModel,
),
);

notifyListeners();
}

/// Start the process of importing a dictionary. This is called from the
Expand Down
39 changes: 24 additions & 15 deletions yuuna/lib/src/pages/implementations/creator_page.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:ui';

import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_expanded_tile/flutter_expanded_tile.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:spaces/spaces.dart';
import 'package:subtitle/subtitle.dart';
Expand Down Expand Up @@ -72,16 +72,15 @@ class _CreatorPageState extends BasePageState<CreatorPage> {
Color get inactiveTextColor => Theme.of(context).unselectedWidgetColor;

/// For controlling collapsed fields.
late final ExpandableController expandableController;
late final ExpandedTileController expandableController;

bool _creatorInitialised = false;

@override
void initState() {
super.initState();

expandableController =
ExpandableController(initialExpanded: !isCardEditing);
expandableController = ExpandedTileController(isExpanded: !isCardEditing);
}

Future<void> initialiseCreator() async {
Expand Down Expand Up @@ -263,19 +262,29 @@ class _CreatorPageState extends BasePageState<CreatorPage> {
return const SizedBox.shrink();
}

return ExpandablePanel(
theme: ExpandableThemeData(
iconPadding: Spacing.of(context).insets.onlyRight.small,
iconSize: Theme.of(context).textTheme.titleLarge?.fontSize,
expandIcon: Icons.arrow_drop_down,
collapseIcon: Icons.arrow_drop_down,
iconColor: Theme.of(context).unselectedWidgetColor,
headerAlignment: ExpandablePanelHeaderAlignment.center,
return ExpandedTile(
theme: ExpandedTileThemeData(
headerRadius: 0,
contentRadius: 0,
headerColor: Colors.transparent,
headerSplashColor:
Theme.of(context).unselectedWidgetColor.withOpacity(0.2),
contentBackgroundColor: Colors.transparent,
titlePadding: EdgeInsets.zero,
headerPadding: EdgeInsets.zero,
contentPadding: EdgeInsets.zero,
leadingPadding: EdgeInsets.zero,
trailingPadding: EdgeInsets.zero,
),
trailing: Icon(
Icons.arrow_drop_down,
size: Theme.of(context).textTheme.titleLarge?.fontSize,
color: Theme.of(context).unselectedWidgetColor,
),
trailingRotation: 0,
controller: expandableController,
header: buildCollapsableHeader(),
collapsed: const SizedBox.shrink(),
expanded: buildCollapsedTextFields(),
title: buildCollapsableHeader(),
content: buildCollapsedTextFields(),
);
}

Expand Down
Loading

0 comments on commit 3270e4f

Please sign in to comment.