Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 🐦 Flutter imports:
import 'package:flutter/material.dart';

// 🌎 Project imports:
import 'package:edokuri/src/controllers/common/file_controller/file_controller.dart';
import 'package:edokuri/src/core/service_locator.dart';
import 'package:edokuri/src/core/widgets/sliver_single_child.dart';
import 'package:edokuri/src/pages/set_page/widgets/studying_card/studying_card.dart';
import 'package:edokuri/src/theme/svgs.dart';
import 'package:edokuri/src/theme/theme_consts.dart';

// 📦 Package imports:

class BookAddButton extends StatelessWidget {
const BookAddButton({super.key});

_upload(BuildContext context) {
getIt<FileController>().getBookFromUser();
}

@override
Widget build(BuildContext context) {
return SliverSingleChild(
Padding(
padding: const EdgeInsets.fromLTRB(
defaultMargin, 0, defaultMargin, defaultMargin),
child: StudyingCard(
width: 16,
title: 'Upload a new book',
subTitle: 'Use epub format',
svg: uploadSvg,
onTap: () => _upload(context),
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:edokuri/src/controllers/stores/repositories/repositories.dart';
import 'package:edokuri/src/controllers/stores/sort_controllers/library_sort_controller/library_sort_controller.dart';
import 'package:edokuri/src/core/service_locator.dart';
import 'package:edokuri/src/pages/home_page/screens/library_screen/widgets/book_add_button.dart';
import 'package:edokuri/src/pages/home_page/screens/library_screen/widgets/book_card/book_card.dart';
import 'package:edokuri/src/theme/theme_consts.dart';

Expand All @@ -21,18 +22,20 @@ class LibraryBookList extends StatelessWidget {
return Observer(builder: (_) {
final books = getIt<LibrarySortController>().sort(bookRepository.books);

return SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => Padding(
padding: const EdgeInsets.fromLTRB(
defaultMargin, 0, defaultMargin, defaultMargin),
child: BookCard(
key: ValueKey(books[index].id),
book: books[index],
),
),
childCount: books.length),
);
return books.isEmpty
? const BookAddButton()
: SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => Padding(
padding: const EdgeInsets.fromLTRB(
defaultMargin, 0, defaultMargin, defaultMargin),
child: BookCard(
key: ValueKey(books[index].id),
book: books[index],
),
),
childCount: books.length),
);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SetAddButton extends StatelessWidget {
width: 24,
title: 'Create new set',
subTitle: 'Sets of records not tied to a book',
svg: addRecordSvg,
svg: createSvg,
onTap: () => _creatNewSet(context),
),
),
Expand Down
1 change: 0 additions & 1 deletion lib/src/pages/set_page/widgets/record_add_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class RecordAddButton extends StatelessWidget {
title: 'Add new records',
subTitle: 'Let\'s fill up the dictionary first',
svg: addRecordSvg,
width: 24,
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
Expand Down
17 changes: 10 additions & 7 deletions lib/src/pages/set_page/widgets/studying_card/studying_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ class StudyingCard extends StatelessWidget {
horizontal: doubleDefaultMargin, vertical: doubleDefaultMargin),
child: Row(
children: [
Center(
child: SvgPicture.asset(
svg,
width: width,
height: height,
colorFilter:
const ColorFilter.mode(darkOrange, BlendMode.srcIn),
SizedBox(
width: 24,
child: Center(
child: SvgPicture.asset(
svg,
width: width,
height: height,
colorFilter:
const ColorFilter.mode(darkOrange, BlendMode.srcIn),
),
),
),
const SizedBox(
Expand Down