Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
joaojsrbr committed May 9, 2022
1 parent 3f6352d commit e0cf8a6
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 60 deletions.
76 changes: 44 additions & 32 deletions lib/app/modules/library/views/library_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LibraryView extends GetView<LibraryController> {
? GetBuilder<HomeController>(
builder: (controller) => GridView.builder(
// controller: c.scrollController,
shrinkWrap: true,
// shrinkWrap: true,

padding: EdgeInsets.only(
right: 4, left: 4, top: 2, bottom: 2),
Expand Down Expand Up @@ -90,37 +90,49 @@ class LibraryView extends GetView<LibraryController> {
physics: BouncingScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverAppBar(
toolbarHeight: 70,
elevation: 0,
pinned: true,
floating: true,
actions: [
IconButton(
enableFeedback: false,
onPressed: () => controller.refreshLibraryScreen(),
icon: Icon(Icons.refresh)),
Obx(() =>
_.selectedIndex == 0 ? LibraryAppBarActions() : SizedBox()),
Obx(() =>
_.selectedIndex == 2 ? BrowseAppBarActions() : SizedBox())
],
// pinned: true,
// floating: true,
title: Text(navigationBarTitles[0].tr),
bottom: controller.categoryListLength <= 1
? null
: TabBar(
controller: controller.tabController,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Theme.of(context).colorScheme.primary,
// padding: EdgeInsets.all(8),
tabs: controller.categoryList
.map<Tab>((e) => Tab(text: e?.name ?? ""))
.toList(),
),
),
Obx(() => SliverAppBar(
// centerTitle: true,
toolbarHeight: 70,
// backgroundColor: Colors.transparent,
// forceElevated: true,
expandedHeight: 130,
// elevation: 0,
pinned: true,
stretch: true,

floating: true,
actions: [
IconButton(
enableFeedback: false,
onPressed: () => controller.refreshLibraryScreen(),
icon: Icon(Icons.refresh)),

// IconButton(
// enableFeedback: false,
// onPressed: () => controller.refreshLibraryScreen(),
// icon: Icon(Icons.refresh)),
Obx(() => _.selectedIndex == 0
? LibraryAppBarActions()
: SizedBox()),
Obx(() => _.selectedIndex == 2
? BrowseAppBarActions()
: SizedBox())
],

title: Text(navigationBarTitles[0].tr),
bottom: controller.categoryListLength <= 1
? null
: TabBar(
controller: controller.tabController,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Theme.of(context).colorScheme.primary,
// padding: EdgeInsets.all(8),
tabs: controller.categoryList
.map<Tab>((e) => Tab(text: e?.name ?? ""))
.toList(),
),
)),
];
},
),
Expand Down
56 changes: 28 additions & 28 deletions lib/app/modules/library/widgets/library_appbar_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,34 @@ class LibraryAppBarActions extends StatelessWidget {
}
}

class MyseachDelegate extends SearchDelegate {
@override
List<Widget>? buildActions(BuildContext context) => [
IconButton(
onPressed: () {
if (query.isEmpty) {
close(context, null);
} else {
query = '';
}
},
icon: const Icon(Icons.clear),
),
];
// class MyseachDelegate extends SearchDelegate {
// @override
// List<Widget>? buildActions(BuildContext context) => [
// IconButton(
// onPressed: () {
// if (query.isEmpty) {
// close(context, null);
// } else {
// query = '';
// }
// },
// icon: const Icon(Icons.clear),
// ),
// ];

@override
Widget? buildLeading(BuildContext context) => IconButton(
onPressed: () => close(context, null),
icon: const Icon(Icons.arrow_back),
);
// @override
// Widget? buildLeading(BuildContext context) => IconButton(
// onPressed: () => close(context, null),
// icon: const Icon(Icons.arrow_back),
// );

@override
Widget buildResults(BuildContext context) {
return Container();
}
// @override
// Widget buildResults(BuildContext context) {
// return Container();
// }

@override
Widget buildSuggestions(BuildContext context) {
return Container();
}
}
// @override
// Widget buildSuggestions(BuildContext context) {
// return Container();
// }
// }
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import 'app/routes/app_pages.dart';
import 'generated/locales.g.dart';

void main() async {
// await GetStorage.init('Tachidesk-Sorayomi');
await GetStorage.init();
WidgetsFlutterBinding.ensureInitialized();
final controller = Get.put(LocalStorageService());
// final controller = Get.put(LocalStorageService(), permanent: true);
runApp(
GetMaterialApp(
title: "Tachidesk Sorayomi",
Expand Down

0 comments on commit e0cf8a6

Please sign in to comment.