Merge branch 'master' into add-more-content-to-search-results

add-more-content-to-search-results
Oystein Kristoffer Tveit 2022-01-23 18:26:40 +01:00 committed by GitHub
commit 650432efbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 412 additions and 384 deletions

View File

@ -95,23 +95,28 @@ class _DrawingBoardState extends State<DrawingBoard> {
Widget kanjiChip(String kanji) => InkWell(
onTap: () => widget.onSuggestionChosen?.call(kanji),
child: Container(
height: fontSize + 2 * suggestionCirclePadding,
width: fontSize + 2 * suggestionCirclePadding,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: BlocProvider.of<ThemeBloc>(context)
.state
.theme
.menuGreyLight
.background,
),
child: Center(
child: Text(
kanji,
style: const TextStyle(fontSize: fontSize),
),
),
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyLight;
return Container(
height: fontSize + 2 * suggestionCirclePadding,
width: fontSize + 2 * suggestionCirclePadding,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Center(
child: Text(
kanji,
style: TextStyle(
fontSize: fontSize,
color: colors.foreground,
),
),
),
);
},
),
);

View File

@ -36,23 +36,23 @@ class DateDivider extends StatelessWidget {
}
@override
Widget build(BuildContext context) {
final Widget header =
(text != null) ? Text(text!) : Text(getHumanReadableDate(date!));
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyNormal;
final ColorSet _menuColors =
BlocProvider.of<ThemeBloc>(context).state.theme.menuGreyNormal;
return Container(
decoration: BoxDecoration(color: _menuColors.background),
padding: const EdgeInsets.symmetric(
vertical: 5,
horizontal: 10,
),
child: DefaultTextStyle.merge(
child: header,
style: TextStyle(color: _menuColors.foreground),
),
);
}
return Container(
decoration: BoxDecoration(color: colors.background),
padding: const EdgeInsets.symmetric(
vertical: 5,
horizontal: 10,
),
child: DefaultTextStyle.merge(
child: (text != null)
? Text(text!)
: Text(getHumanReadableDate(date!)),
style: TextStyle(color: colors.foreground),
),
);
},
);
}

View File

@ -11,31 +11,31 @@ class KanjiBox extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
final ColorSet menuColors =
BlocProvider.of<ThemeBloc>(context).state.theme.menuGreyLight;
return IntrinsicHeight(
child: AspectRatio(
aspectRatio: 1,
child: Container(
padding: const EdgeInsets.all(5),
alignment: Alignment.center,
decoration: BoxDecoration(
color: menuColors.background,
borderRadius: BorderRadius.circular(10.0),
),
child: FittedBox(
child: Text(
kanji,
style: TextStyle(
color: menuColors.foreground,
fontSize: 25,
),
),
Widget build(BuildContext context) => IntrinsicHeight(
child: AspectRatio(
aspectRatio: 1,
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyLight;
return Container(
padding: const EdgeInsets.all(5),
alignment: Alignment.center,
decoration: BoxDecoration(
color: colors.background,
borderRadius: BorderRadius.circular(10.0),
),
child: FittedBox(
child: Text(
kanji,
style: TextStyle(
color: colors.foreground,
fontSize: 25,
),
),
),
);
},
),
),
),
);
}
);
}

View File

@ -23,22 +23,23 @@ class Examples extends StatelessWidget {
onyomi.map((onEx) => _Example(onEx, _KanaType.onyomi)).toList() +
kunyomi.map((kunEx) => _Example(kunEx, _KanaType.kunyomi)).toList();
const noExamplesWidget = [
Padding(
padding: EdgeInsets.symmetric(vertical: 10),
child: Text('No Examples', style: textStyle),
)
];
const noExamplesWidget = Padding(
padding: EdgeInsets.symmetric(vertical: 10),
child: Text('No Examples', style: textStyle),
);
return Column(
children: <Widget>[
Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
alignment: Alignment.centerLeft,
child: const Text('Examples:', style: textStyle),
)
] +
(onyomi.isEmpty && kunyomi.isEmpty ? noExamplesWidget : yomiWidgets),
Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
alignment: Alignment.centerLeft,
child: const Text('Examples:', style: textStyle),
),
if (onyomi.isEmpty && kunyomi.isEmpty)
noExamplesWidget
else
...yomiWidgets
],
);
}
}
@ -52,31 +53,34 @@ class _Example extends StatelessWidget {
const _Example(this.yomiExample, this.kanaType);
@override
Widget build(BuildContext context) {
final theme = BlocProvider.of<ThemeBloc>(context).state.theme;
final menuColors = theme.menuGreyNormal;
final kanaColors =
kanaType == _KanaType.kunyomi ? theme.kunyomiColor : theme.onyomiColor;
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final theme = state.theme;
final menuColors = theme.menuGreyNormal;
final kanaColors = kanaType == _KanaType.kunyomi
? theme.kunyomiColor
: theme.onyomiColor;
return Container(
margin: const EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 10.0,
),
decoration: BoxDecoration(
color: menuColors.background,
borderRadius: BorderRadius.circular(10.0),
),
child: IntrinsicHeight(
child: Row(
children: [
_Kana(colors: kanaColors, example: yomiExample),
_ExampleText(colors: menuColors, example: yomiExample)
],
),
),
);
}
return Container(
margin: const EdgeInsets.symmetric(
vertical: 5.0,
horizontal: 10.0,
),
decoration: BoxDecoration(
color: menuColors.background,
borderRadius: BorderRadius.circular(10.0),
),
child: IntrinsicHeight(
child: Row(
children: [
_Kana(colors: kanaColors, example: yomiExample),
_ExampleText(colors: menuColors, example: yomiExample)
],
),
),
);
},
);
}
class _Kana extends StatelessWidget {
@ -89,7 +93,6 @@ class _Kana extends StatelessWidget {
required this.example,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
@ -105,7 +108,9 @@ class _Kana extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
romajiEnabled ? transliterateKanaToLatin(example.reading) : example.reading,
romajiEnabled
? transliterateKanaToLatin(example.reading)
: example.reading,
style: TextStyle(
color: colors.foreground,
fontSize: 15.0,

View File

@ -13,23 +13,24 @@ class Grade extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors =
BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: colors.background,
shape: BoxShape.circle,
),
child: Text(
grade ?? ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
}
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: colors.background,
shape: BoxShape.circle,
),
child: Text(
grade ?? ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
},
);
}

View File

@ -11,24 +11,25 @@ class Header extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors =
BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
Widget build(BuildContext context) => AspectRatio(
aspectRatio: 1,
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return AspectRatio(
aspectRatio: 1,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: colors.background,
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: colors.background,
),
child: Center(
child: Text(
kanji,
style: TextStyle(fontSize: 70.0, color: colors.foreground),
),
),
);
},
),
child: Center(
child: Text(
kanji,
style: TextStyle(fontSize: 70.0, color: colors.foreground),
),
),
),
);
}
);
}

View File

@ -13,23 +13,23 @@ class JlptLevel extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors =
BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
jlptLevel ?? ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
}
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
jlptLevel ?? ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
},
);
}

View File

@ -6,25 +6,30 @@ import '../../../bloc/theme/theme_bloc.dart';
class Radical extends StatelessWidget {
final jisho.Radical radical;
const Radical({required this.radical, Key? key,}) : super(key: key);
const Radical({
required this.radical,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors = BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
radical.symbol,
style: TextStyle(
color: colors.foreground,
fontSize: 40.0,
),
),
);
}
return Container(
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
radical.symbol,
style: TextStyle(
color: colors.foreground,
fontSize: 40.0,
),
),
);
},
);
}

View File

@ -13,24 +13,25 @@ class Rank extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors =
BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: (rank == null) ? BoxShape.circle : BoxShape.rectangle,
borderRadius: (rank == null) ? null : BorderRadius.circular(10.0),
color: colors.background,
),
child: Text(
rank != null ? '${rank.toString()} / 2500' : ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
}
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: (rank == null) ? BoxShape.circle : BoxShape.rectangle,
borderRadius: (rank == null) ? null : BorderRadius.circular(10.0),
color: colors.background,
),
child: Text(
rank != null ? '${rank.toString()} / 2500' : ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
),
),
);
},
);
}

View File

@ -5,24 +5,26 @@ import '../../../bloc/theme/theme_bloc.dart';
class StrokeOrderGif extends StatelessWidget {
final String uri;
const StrokeOrderGif({required this.uri, Key? key,}) : super(key: key);
const StrokeOrderGif({
required this.uri,
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final colors = BlocProvider.of<ThemeBloc>(context).state.theme.kanjiResultColor;
return Container(
margin: const EdgeInsets.symmetric(vertical: 20.0),
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: colors.background,
borderRadius: BorderRadius.circular(15.0),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.network(uri),
),
);
}
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 20.0),
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: state.theme.kanjiResultColor.background,
borderRadius: BorderRadius.circular(15.0),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.network(uri),
),
);
},
);
}

View File

@ -23,6 +23,7 @@ extension on YomiType {
}
ColorSet getColors(BuildContext context) {
// TODO: convert this into a blocbuilder or bloclistener
final theme = BlocProvider.of<ThemeBloc>(context).state.theme;
switch (this) {
@ -70,7 +71,7 @@ class YomiChips extends StatelessWidget {
),
),
);
Widget yomiWrapper(BuildContext context) {
final yomiCards = yomi
.map((y) => romajiEnabled ? transliterateKanaToLatin(y) : y)
@ -78,16 +79,16 @@ class YomiChips extends StatelessWidget {
.toList();
final yomiCardsWithTitle = <Widget>[
if (type != YomiType.meaning)
yomiCard(
yomi: type == YomiType.kunyomi ? 'Kun:' : 'On:',
colors: ColorSet(
foreground: type.getColors(context).background,
background: const Color(0x000000ff),
),
),
] +
yomiCards;
if (type != YomiType.meaning)
yomiCard(
yomi: type == YomiType.kunyomi ? 'Kun:' : 'On:',
colors: ColorSet(
foreground: type.getColors(context).background,
background: Colors.transparent,
),
),
...yomiCards
];
final wrap = Wrap(
runSpacing: 10.0,

View File

@ -20,12 +20,14 @@ class KanjiSearchOptionsBar extends StatelessWidget {
const SizedBox(width: 10),
_IconButton(
icon: const Icon(Icons.school),
onPressed: () => Navigator.pushNamed(context, Routes.kanjiSearchGrade),
onPressed: () =>
Navigator.pushNamed(context, Routes.kanjiSearchGrade),
),
const SizedBox(width: 10),
_IconButton(
icon: const Icon(Icons.mode),
onPressed: () => Navigator.pushNamed(context, Routes.kanjiSearchDraw),
onPressed: () =>
Navigator.pushNamed(context, Routes.kanjiSearchDraw),
),
],
),
@ -44,12 +46,12 @@ class _IconButton extends StatelessWidget {
}) : super(key: key);
@override
Widget build(BuildContext context) {
return IconButton(
onPressed: onPressed,
icon: icon,
iconSize: 30,
color: BlocProvider.of<ThemeBloc>(context).state.theme.menuGreyDark.background,
);
}
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) => IconButton(
onPressed: onPressed,
icon: icon,
iconSize: 30,
color: state.theme.menuGreyDark.background,
),
);
}

View File

@ -29,8 +29,11 @@ class _GridItem extends StatelessWidget {
? () => ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(text)),
)
: () =>
Navigator.popAndPushNamed(context, Routes.kanjiSearch, arguments: text);
: () => Navigator.popAndPushNamed(
context,
Routes.kanjiSearch,
arguments: text,
);
return InkWell(
onTap: onTap,
@ -61,8 +64,10 @@ class _KanjiGradeSearchState extends State<KanjiGradeSearch> {
sortedByStrokes.map<int, List<Widget>>(
(strokeCount, kanji) => MapEntry(
strokeCount,
[_GridItem(text: strokeCount.toString(), isNumber: true)] +
kanji.map((k) => _GridItem(text: k)).toList(),
[
_GridItem(text: strokeCount.toString(), isNumber: true),
...kanji.map((k) => _GridItem(text: k)).toList(),
],
),
),
),

View File

@ -91,8 +91,7 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
);
}
List<Widget> get radicalGridElements =>
<Widget>[
List<Widget> get radicalGridElements => <Widget>[
IconButton(
onPressed: () => setState(() {
suggestions.clear();
@ -103,22 +102,25 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
color: AppTheme.jishoGreen.background,
iconSize: fontSize * 1.3,
),
] +
radicals
.map(
(key, value) => MapEntry(
key,
value
.where((r) => allowedToggles[r]!)
.map((r) => radicalGridElement(r))
.toList()
..insert(0, radicalGridElement(key.toString(), isNumber: true)),
),
)
.values
.where((element) => element.length != 1)
.expand((l) => l)
.toList();
...radicals
.map(
(key, value) => MapEntry(
key,
value
.where((r) => allowedToggles[r]!)
.map((r) => radicalGridElement(r))
.toList()
..insert(
0,
radicalGridElement(key.toString(), isNumber: true),
),
),
)
.values
.where((element) => element.length != 1)
.expand((l) => l)
.toList()
];
Widget kanjiGridElement(String kanji) {
const color = LightTheme.defaultMenuGreyNormal;
@ -154,15 +156,13 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
Expanded(
child: (suggestions.isEmpty)
? Center(
child: Text(
'Toggle a radical to start',
style: TextStyle(
fontSize: fontSize * 0.8,
color: BlocProvider.of<ThemeBloc>(context)
.state
.theme
.menuGreyNormal
.background,
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) => Text(
'Toggle a radical to start',
style: TextStyle(
fontSize: fontSize * 0.8,
color: state.theme.menuGreyNormal.background,
),
),
),
)

View File

@ -37,124 +37,125 @@ class _SettingsViewState extends State<SettingsView> {
}
@override
Widget build(BuildContext context) {
final TextStyle _titleTextStyle = TextStyle(
color: BlocProvider.of<ThemeBloc>(context).state is DarkThemeState
? AppTheme.jishoGreen.background
: null,
);
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final TextStyle _titleTextStyle = TextStyle(
color:
state is DarkThemeState ? AppTheme.jishoGreen.background : null,
);
return SettingsList(
backgroundColor: Colors.transparent,
contentPadding: const EdgeInsets.symmetric(vertical: 10),
sections: <SettingsSection>[
SettingsSection(
title: 'Dictionary',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Use romaji',
onToggle: (b) {
setState(() => romajiEnabled = b);
},
switchValue: romajiEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Extensive search',
onToggle: (b) {
setState(() => extensiveSearchEnabled = b);
},
switchValue: extensiveSearchEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
subtitle:
'Gathers extra data when searching for words, at the expense of having to wait for extra word details',
subtitleMaxLines: 3,
),
],
),
SettingsSection(
title: 'Theme',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Automatically determine theme',
onToggle: toggleAutoTheme,
switchValue: autoThemeEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Dark Theme',
onToggle: (b) {
BlocProvider.of<ThemeBloc>(context)
.add(SetTheme(themeIsDark: b));
setState(() => darkThemeEnabled = b);
},
switchValue: darkThemeEnabled,
enabled: !autoThemeEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
],
),
SettingsSection(
title: 'Cache',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Cache grade 1-7 kanji',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache grade standard kanji',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache all favourites',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache all searches',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
],
),
SettingsSection(
title: 'Data',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile(
leading: const Icon(Icons.file_download),
title: 'Export Data',
enabled: false,
),
SettingsTile(
leading: const Icon(Icons.delete),
title: 'Clear History',
onPressed: clearHistory,
titleTextStyle: const TextStyle(color: Colors.red),
),
SettingsTile(
leading: const Icon(Icons.delete),
title: 'Clear Favourites',
onPressed: (c) {},
titleTextStyle: const TextStyle(color: Colors.red),
enabled: false,
)
],
),
],
);
}
return SettingsList(
backgroundColor: Colors.transparent,
contentPadding: const EdgeInsets.symmetric(vertical: 10),
sections: <SettingsSection>[
SettingsSection(
title: 'Dictionary',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Use romaji',
onToggle: (b) {
setState(() => romajiEnabled = b);
},
switchValue: romajiEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Extensive search',
onToggle: (b) {
setState(() => extensiveSearchEnabled = b);
},
switchValue: extensiveSearchEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
subtitle:
'Gathers extra data when searching for words, at the expense of having to wait for extra word details',
subtitleMaxLines: 3,
),
],
),
SettingsSection(
title: 'Theme',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Automatically determine theme',
onToggle: toggleAutoTheme,
switchValue: autoThemeEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Dark Theme',
onToggle: (b) {
BlocProvider.of<ThemeBloc>(context)
.add(SetTheme(themeIsDark: b));
setState(() => darkThemeEnabled = b);
},
switchValue: darkThemeEnabled,
enabled: !autoThemeEnabled,
switchActiveColor: AppTheme.jishoGreen.background,
),
],
),
SettingsSection(
title: 'Cache',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: 'Cache grade 1-7 kanji',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache grade standard kanji',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache all favourites',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
SettingsTile.switchTile(
title: 'Cache all searches',
switchValue: false,
onToggle: (v) {},
enabled: false,
switchActiveColor: AppTheme.jishoGreen.background,
),
],
),
SettingsSection(
title: 'Data',
titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile(
leading: const Icon(Icons.file_download),
title: 'Export Data',
enabled: false,
),
SettingsTile(
leading: const Icon(Icons.delete),
title: 'Clear History',
onPressed: clearHistory,
titleTextStyle: const TextStyle(color: Colors.red),
),
SettingsTile(
leading: const Icon(Icons.delete),
title: 'Clear Favourites',
onPressed: (c) {},
titleTextStyle: const TextStyle(color: Colors.red),
enabled: false,
)
],
),
],
);
},
);
}

View File

@ -1,6 +1,5 @@
import 'package:unofficial_jisho_api/api.dart' as jisho;
export 'package:unofficial_jisho_api/api.dart' show JishoAPIResult;
export 'package:unofficial_jisho_api/api.dart' show JishoAPIResult;
Future<jisho.JishoAPIResult> fetchJishoResults(searchTerm) async {
return jisho.searchForPhrase(searchTerm);
}
Future<jisho.JishoAPIResult> fetchJishoResults(searchTerm) =>
jisho.searchForPhrase(searchTerm);