mirror of
https://github.com/mateusz-bak/openreads.git
synced 2025-08-06 14:19:22 +08:00
refactor: Removed unused strings, code cleaup
This commit is contained in:
@ -39,7 +39,6 @@
|
||||
"start_reading": "Start",
|
||||
"rate_book": "Rate this book",
|
||||
"skip": "Skip",
|
||||
"reading_time": "Reading time",
|
||||
"pages_uppercase": "Pages",
|
||||
"pages_lowercase": "pages",
|
||||
"click_to_add_cover": "Click to add cover",
|
||||
@ -63,7 +62,6 @@
|
||||
"select_finish_date": "Select reading finish date",
|
||||
"title_cannot_be_empty": "Title cannot be empty",
|
||||
"author_cannot_be_empty": "Author cannot be empty",
|
||||
"set_book_status": "Set book status",
|
||||
"finish_date_before_start": "Finish date cannot be before start date",
|
||||
"title": "Title",
|
||||
"author": "Author",
|
||||
@ -99,7 +97,6 @@
|
||||
"books_challenge": "Finished books challenge",
|
||||
"pages_challenge": "Finished pages challenge",
|
||||
"all_years": "All",
|
||||
"no_finished_books": "No finished books",
|
||||
"all_books_by_status": "All books by status",
|
||||
"finished_books_by_month": "Finished books by month",
|
||||
"finished_pages_by_month": "Finished pages by month",
|
||||
@ -207,7 +204,6 @@
|
||||
"restore_backup_description_2": "Works for backups not older than from v1.14.2",
|
||||
"are_you_sure": "Are you sure?",
|
||||
"restore_backup_alert_content": "This will delete all your current books and challenges!",
|
||||
"error_getting_book": "Error while getting the book",
|
||||
"add_books_and_come_back": "Add some books and come here again",
|
||||
"welcome_1": "Welcome to Openreads",
|
||||
"welcome_1_description_1": "Openreads will help you keep track of your books.",
|
||||
@ -259,10 +255,6 @@
|
||||
},
|
||||
"set_custom_reading_time": "Set custom reading time",
|
||||
"select_all": "Select all",
|
||||
"tags": {
|
||||
"one": "Tag",
|
||||
"other": "Tags"
|
||||
},
|
||||
"general_search": "General",
|
||||
"no_search_results": "No results found",
|
||||
"click_to_add_book_manually": "Click here to add the book manually",
|
||||
|
@ -41,7 +41,6 @@ abstract class LocaleKeys {
|
||||
static const start_reading = 'start_reading';
|
||||
static const rate_book = 'rate_book';
|
||||
static const skip = 'skip';
|
||||
static const reading_time = 'reading_time';
|
||||
static const pages_uppercase = 'pages_uppercase';
|
||||
static const pages_lowercase = 'pages_lowercase';
|
||||
static const click_to_add_cover = 'click_to_add_cover';
|
||||
@ -65,7 +64,6 @@ abstract class LocaleKeys {
|
||||
static const select_finish_date = 'select_finish_date';
|
||||
static const title_cannot_be_empty = 'title_cannot_be_empty';
|
||||
static const author_cannot_be_empty = 'author_cannot_be_empty';
|
||||
static const set_book_status = 'set_book_status';
|
||||
static const finish_date_before_start = 'finish_date_before_start';
|
||||
static const title = 'title';
|
||||
static const author = 'author';
|
||||
@ -100,7 +98,6 @@ abstract class LocaleKeys {
|
||||
static const books_challenge = 'books_challenge';
|
||||
static const pages_challenge = 'pages_challenge';
|
||||
static const all_years = 'all_years';
|
||||
static const no_finished_books = 'no_finished_books';
|
||||
static const all_books_by_status = 'all_books_by_status';
|
||||
static const finished_books_by_month = 'finished_books_by_month';
|
||||
static const finished_pages_by_month = 'finished_pages_by_month';
|
||||
@ -211,7 +208,6 @@ abstract class LocaleKeys {
|
||||
static const restore_backup_description_2 = 'restore_backup_description_2';
|
||||
static const are_you_sure = 'are_you_sure';
|
||||
static const restore_backup_alert_content = 'restore_backup_alert_content';
|
||||
static const error_getting_book = 'error_getting_book';
|
||||
static const add_books_and_come_back = 'add_books_and_come_back';
|
||||
static const welcome_1 = 'welcome_1';
|
||||
static const welcome_1_description_1 = 'welcome_1_description_1';
|
||||
@ -257,7 +253,6 @@ abstract class LocaleKeys {
|
||||
static const set_custom_reading_time = 'set_custom_reading_time';
|
||||
static const select_all = 'select_all';
|
||||
static const only_editions_with_covers = 'only_editions_with_covers';
|
||||
static const tags = 'tags';
|
||||
static const general_search = 'general_search';
|
||||
static const no_search_results = 'no_search_results';
|
||||
static const click_to_add_book_manually = 'click_to_add_book_manually';
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'package:barcode_scan2/gen/protos/protos.pbenum.dart';
|
||||
import 'package:barcode_scan2/platform_wrapper.dart';
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -565,7 +564,15 @@ class _AddBookScreenState extends State<AddBookScreen> {
|
||||
borderRadius: BorderRadius.circular(cornerRadius),
|
||||
),
|
||||
onTap: () async {
|
||||
var result = await BarcodeScanner.scan();
|
||||
var result = await BarcodeScanner.scan(
|
||||
options: ScanOptions(
|
||||
strings: {
|
||||
'cancel': LocaleKeys.cancel.tr(),
|
||||
'flash_on': LocaleKeys.flash_on.tr(),
|
||||
'flash_off': LocaleKeys.flash_off.tr(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (result.type == ResultType.Barcode) {
|
||||
setState(() {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:openreads/core/themes/app_theme.dart';
|
||||
import 'package:openreads/generated/locale_keys.g.dart';
|
||||
import 'package:openreads/main.dart';
|
||||
import 'package:openreads/model/book.dart';
|
||||
@ -38,24 +38,22 @@ class _SimiliarBooksScreenState extends State<SimiliarBooksScreen> {
|
||||
title: Row(
|
||||
children: [
|
||||
widget.tag != null
|
||||
? Text(
|
||||
'${LocaleKeys.tags.plural(1).capitalize.tr()}: ',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
? const SizedBox()
|
||||
: widget.author != null
|
||||
? Text(
|
||||
'${LocaleKeys.author.tr()}: ',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
)
|
||||
: const SizedBox(),
|
||||
Text(
|
||||
widget.tag != null
|
||||
? widget.tag!
|
||||
: widget.author != null
|
||||
? widget.author!
|
||||
: '',
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
widget.tag != null
|
||||
? _buildTag(widget.tag!)
|
||||
: widget.author != null
|
||||
? Text(
|
||||
widget.author!,
|
||||
style: const TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.bold),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -81,4 +79,28 @@ class _SimiliarBooksScreenState extends State<SimiliarBooksScreen> {
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTag(String tag) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: FilterChip(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
side: BorderSide(
|
||||
color: dividerColor,
|
||||
width: 1,
|
||||
),
|
||||
label: Text(
|
||||
tag,
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: true,
|
||||
maxLines: 5,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSecondary,
|
||||
),
|
||||
),
|
||||
clipBehavior: Clip.none,
|
||||
onSelected: (_) {},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -158,14 +158,6 @@ class Statistics extends StatelessWidget {
|
||||
builder: (context, challengeState) {
|
||||
if (challengeState is SetChallengeState &&
|
||||
challengeState.yearlyChallenges != null) {
|
||||
if (state.finishedBooksByMonthAllTypes.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
LocaleKeys.no_finished_books.tr(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final yearlyChallenges = List<YearlyChallenge>.empty(
|
||||
growable: true,
|
||||
);
|
||||
@ -233,14 +225,6 @@ class Statistics extends StatelessWidget {
|
||||
builder: (context, challengeState) {
|
||||
if (challengeState is SetChallengeState &&
|
||||
challengeState.yearlyChallenges != null) {
|
||||
if (state.finishedPagesByMonthAllTypes.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
LocaleKeys.no_finished_books.tr(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final yearlyChallenges = List<YearlyChallenge>.empty(
|
||||
growable: true,
|
||||
);
|
||||
|
@ -215,8 +215,8 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
controller: _controller,
|
||||
count: 4,
|
||||
effect: ExpandingDotsEffect(
|
||||
activeDotColor: widget.themeData.colorScheme.primary,
|
||||
dotColor: widget.themeData.colorScheme.surfaceVariant,
|
||||
activeDotColor: Theme.of(context).colorScheme.primary,
|
||||
dotColor: Theme.of(context).colorScheme.surfaceVariant,
|
||||
dotHeight: 12,
|
||||
dotWidth: 12,
|
||||
),
|
||||
|
@ -15,7 +15,7 @@ class WelcomeChoiceButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -23,7 +23,7 @@ class WelcomeChoiceButton extends StatelessWidget {
|
||||
style: ButtonStyle(
|
||||
backgroundColor: isSkipImporting
|
||||
? MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.secondary,
|
||||
Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: MaterialStateProperty.all(
|
||||
Theme.of(context)
|
||||
@ -64,7 +64,7 @@ class WelcomeChoiceButton extends StatelessWidget {
|
||||
child: Text(
|
||||
description,
|
||||
style: TextStyle(
|
||||
fontSize: isSkipImporting ? 20 : 18,
|
||||
fontSize: 16,
|
||||
fontWeight: isSkipImporting
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
|
@ -19,14 +19,6 @@ class WelcomePageChoices extends StatelessWidget {
|
||||
final Function() importBookwyrmCsv;
|
||||
final Function() skipImportingBooks;
|
||||
|
||||
static List<String> choices = [
|
||||
LocaleKeys.restore_backup.tr(),
|
||||
LocaleKeys.import_csv.tr(),
|
||||
LocaleKeys.import_goodreads_csv.tr(),
|
||||
LocaleKeys.import_bookwyrm_csv.tr(),
|
||||
LocaleKeys.add_books_and_come_back.tr(),
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
@ -55,6 +47,7 @@ class WelcomePageChoices extends StatelessWidget {
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
WelcomeChoiceButton(
|
||||
description: LocaleKeys.restore_backup.tr(),
|
||||
onPressed: restoreBackup,
|
||||
|
Reference in New Issue
Block a user