Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Nov 1, 2024
2 parents f4317fe + ee60398 commit 7920fb6
Show file tree
Hide file tree
Showing 40 changed files with 451 additions and 383 deletions.
40 changes: 19 additions & 21 deletions lib/app/view/master_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,25 @@ class MasterDetailPage extends StatelessWidget with WatchItMixin {
),
if (context.showMasterPanel) const VerticalDivider(),
Expanded(
child: BackGesture(
child: Navigator(
// ignore: deprecated_member_use
onPopPage: (route, result) => route.didPop(result),
key: masterNavigator,
onGenerateRoute: (settings) {
final page = (masterItems.firstWhereOrNull(
(e) =>
e.pageId == settings.name ||
e.pageId == libraryModel.selectedPageId,
) ??
masterItems.elementAt(0))
.pageBuilder(context);
child: Navigator(
initialRoute: libraryModel.selectedPageId ?? kSearchPageId,
onDidRemovePage: (page) {},
key: libraryModel.masterNavigatorKey,
observers: [libraryModel],
onGenerateRoute: (settings) {
final page = (masterItems.firstWhereOrNull(
(e) => e.pageId == settings.name,
) ??
masterItems.elementAt(0))
.pageBuilder(context);

return PageRouteBuilder(
pageBuilder: (_, __, ___) => page,
transitionsBuilder: (_, a, __, c) =>
FadeTransition(opacity: a, child: c),
);
},
),
return PageRouteBuilder(
settings: settings,
pageBuilder: (_, __, ___) => BackGesture(child: page),
transitionsBuilder: (_, a, __, c) =>
FadeTransition(opacity: a, child: c),
);
},
),
),
],
Expand Down Expand Up @@ -146,7 +144,7 @@ class MasterPanel extends StatelessWidget {
},
);
} else {
libraryModel.pushNamed(pageId: item.pageId);
libraryModel.push(pageId: item.pageId);
}

if (!context.showMasterPanel) {
Expand Down
4 changes: 2 additions & 2 deletions lib/common/logging.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/foundation.dart';

void printMessageInDebugMode(String message) {
void printMessageInDebugMode(Object? object) {
if (kDebugMode) {
print(message);
print(object);
}
}
22 changes: 17 additions & 5 deletions lib/common/view/audio_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin {
required this.audioPageType,
required this.showLeading,
this.selectedColor,
this.onTitleTap,
});

final String pageId;
Expand All @@ -39,6 +40,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin {

final bool isPlayerPlaying;
final void Function()? onTap;
final void Function()? onTitleTap;
final void Function(String text)? onSubTitleTap;
final void Function(Audio audio)? insertIntoQueue;
final bool showLeading;
Expand Down Expand Up @@ -78,6 +80,9 @@ class _AudioTileState extends State<AudioTile> {
),
};

const titleOverflow = TextOverflow.ellipsis;
const titleMaxLines = 1;

return MouseRegion(
key: ObjectKey(widget.audio),
onEnter: (e) {
Expand Down Expand Up @@ -111,11 +116,18 @@ class _AudioTileState extends State<AudioTile> {
},
title: Padding(
padding: const EdgeInsets.only(right: kYaruPagePadding),
child: Text(
widget.audio.title ?? l10n.unknown,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
child: widget.onTitleTap == null
? Text(
widget.audio.title ?? l10n.unknown,
overflow: titleOverflow,
maxLines: titleMaxLines,
)
: TapAbleText(
onTap: widget.onTitleTap,
text: widget.audio.title ?? l10n.unknown,
overflow: titleOverflow,
maxLines: titleMaxLines,
),
),
subtitle: TapAbleText(
text: subTitle,
Expand Down
3 changes: 3 additions & 0 deletions lib/common/view/country_auto_complete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CountryAutoComplete extends StatelessWidget {
this.fillColor,
this.contentPadding,
this.suffixIcon,
this.autofocus = false,
});

final void Function(Country? country)? onSelected;
Expand All @@ -45,6 +46,7 @@ class CountryAutoComplete extends StatelessWidget {
final Color? fillColor;
final EdgeInsets? contentPadding;
final Widget? suffixIcon;
final bool autofocus;

@override
Widget build(BuildContext context) {
Expand All @@ -70,6 +72,7 @@ class CountryAutoComplete extends StatelessWidget {
final hintText =
'${context.l10n.search}: ${context.l10n.country}';
return TextField(
autofocus: autofocus,
maxLines: 1,
onTap: () {
textEditingController.selection = TextSelection(
Expand Down
1 change: 0 additions & 1 deletion lib/common/view/global_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ final GlobalKey<NavigatorState> manualAddNavigatorKey =
GlobalKey<NavigatorState>();

final GlobalKey<ScaffoldState> masterScaffoldKey = GlobalKey();
final GlobalKey<NavigatorState> masterNavigator = GlobalKey<NavigatorState>();
3 changes: 3 additions & 0 deletions lib/common/view/language_autocomplete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class LanguageAutoComplete extends StatelessWidget {
this.fillColor,
this.contentPadding,
this.suffixIcon,
this.autofocus = false,
});

final void Function(SimpleLanguage? language)? onSelected;
Expand All @@ -43,6 +44,7 @@ class LanguageAutoComplete extends StatelessWidget {
final Color? fillColor;
final EdgeInsets? contentPadding;
final Widget? suffixIcon;
final bool autofocus;

@override
Widget build(BuildContext context) {
Expand All @@ -68,6 +70,7 @@ class LanguageAutoComplete extends StatelessWidget {
final hintText =
'${context.l10n.search}: ${context.l10n.language}';
return TextField(
autofocus: autofocus,
maxLines: 1,
onTap: () {
textEditingController.selection = TextSelection(
Expand Down
4 changes: 4 additions & 0 deletions lib/common/view/search_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SearchInput extends StatefulWidget {
this.onChanged,
this.hintText,
this.suffixIcon,
this.prefixIcon,
this.autoFocus = true,
});
final String? text;
Expand All @@ -20,6 +21,7 @@ class SearchInput extends StatefulWidget {
final void Function(String)? onChanged;
final String? hintText;
final Widget? suffixIcon;
final Widget? prefixIcon;
final bool autoFocus;

@override
Expand Down Expand Up @@ -73,11 +75,13 @@ class _SearchInputState extends State<SearchInput> {
theme: theme,
hintText: widget.hintText,
suffixIcon: widget.suffixIcon,
prefixIcon: widget.prefixIcon,
)
: createMaterialDecoration(
colorScheme: theme.colorScheme,
hintText: widget.hintText,
suffixIcon: widget.suffixIcon,
prefixIcon: widget.prefixIcon,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/common/view/sliver_audio_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SliverAudioPage extends StatelessWidget {
padding: appBarSingleActionSpacing,
child: SearchButton(
onPressed: () {
di<LibraryModel>().pushNamed(pageId: kSearchPageId);
di<LibraryModel>().push(pageId: kSearchPageId);
final searchModel = di<SearchModel>();
if (searchModel.audioType != AudioType.local) {
searchModel
Expand Down
4 changes: 4 additions & 0 deletions lib/common/view/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ InputDecoration createMaterialDecoration({
EdgeInsets? contentPadding,
String? hintText,
Widget? suffixIcon,
Widget? prefixIcon,
}) {
final outlineInputBorder = border ??
OutlineInputBorder(
borderRadius: BorderRadius.circular(100),
borderSide: BorderSide(width: 1, color: colorScheme.outline),
);
return InputDecoration(
prefixIcon: prefixIcon,
suffixIcon: suffixIcon,
suffixIconConstraints: const BoxConstraints(
maxWidth: 200,
Expand Down Expand Up @@ -162,6 +164,7 @@ InputDecoration createYaruDecoration({
String? hintText,
OutlineInputBorder? border,
Widget? suffixIcon,
Widget? prefixIcon,
}) {
final fill = theme.inputDecorationTheme.fillColor;

Expand All @@ -172,6 +175,7 @@ InputDecoration createYaruDecoration({
);

return InputDecoration(
prefixIcon: prefixIcon,
suffixIcon: Center(
widthFactor: 1,
child: suffixIcon,
Expand Down
Loading

0 comments on commit 7920fb6

Please sign in to comment.