diff --git a/README.md b/README.md
index 037e2ef..6877c70 100644
--- a/README.md
+++ b/README.md
@@ -1,47 +1,9 @@
-# Task 3 - Book Store App
+## Task 3 - Book Store App
-Task resolution process:
+
-- Fork the repo
-- Clone the forked repo to your local machine
-- Resolve the task
-- Commit your solution
-- Push to GitHub
-- create a pull request
+
+
-
-### Task 3:
-Build a book store mobile application. The store contain a list of available books with the ability to add custom books to the store as well as view, order them.
-
-* Don't use pre-made widgets (packges).
-* It's ok to use icons packages.
-* Use Getx for state management.
-
-## UI
-### Main Page
-The main page should contain a list of the available books. When tapping on a book, the second page (Book Details Page) will be navigated. Use Scrollable view for the list of books. ALso there is a simple search on the top of the page.
-
-
-### Cart Page (Optional)
-This page can view the ordered books.
-
-### Details Page
-This have the details of the book which is:
-- Book name
-- Author
-- Desciption
-- Image
-- Rate (constant)
-
-### Add Page
-It is the page where you can add new books to the store.
-
-## FLow
-1. Build the UI (from figma design).
-2. seperate the widgets to small and organized files.
-3. Build models that contain the book data (You can build one model or more).
-4. Try to seperate the logic (Functions and data) from the UI.
-
-## Figma Design
-https://www.figma.com/file/4BGkiFfTPT7b8K9pyFTBD6/Online-Book-Store-App-(2019)-(Community)?node-id=0%3A1
+
diff --git a/assets/fonts/Poppins/OFL.txt b/assets/fonts/Poppins/OFL.txt
new file mode 100644
index 0000000..246c977
--- /dev/null
+++ b/assets/fonts/Poppins/OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/assets/fonts/Poppins/Poppins-Black.ttf b/assets/fonts/Poppins/Poppins-Black.ttf
new file mode 100644
index 0000000..71c0f99
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Black.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-BlackItalic.ttf b/assets/fonts/Poppins/Poppins-BlackItalic.ttf
new file mode 100644
index 0000000..7aeb58b
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-BlackItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Bold.ttf b/assets/fonts/Poppins/Poppins-Bold.ttf
new file mode 100644
index 0000000..00559ee
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Bold.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-BoldItalic.ttf b/assets/fonts/Poppins/Poppins-BoldItalic.ttf
new file mode 100644
index 0000000..e61e8e8
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-BoldItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-ExtraBold.ttf b/assets/fonts/Poppins/Poppins-ExtraBold.ttf
new file mode 100644
index 0000000..df70936
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-ExtraBold.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-ExtraBoldItalic.ttf b/assets/fonts/Poppins/Poppins-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..14d2b37
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-ExtraBoldItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-ExtraLight.ttf b/assets/fonts/Poppins/Poppins-ExtraLight.ttf
new file mode 100644
index 0000000..e76ec69
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-ExtraLight.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-ExtraLightItalic.ttf b/assets/fonts/Poppins/Poppins-ExtraLightItalic.ttf
new file mode 100644
index 0000000..89513d9
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-ExtraLightItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Italic.ttf b/assets/fonts/Poppins/Poppins-Italic.ttf
new file mode 100644
index 0000000..12b7b3c
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Italic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Light.ttf b/assets/fonts/Poppins/Poppins-Light.ttf
new file mode 100644
index 0000000..bc36bcc
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Light.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-LightItalic.ttf b/assets/fonts/Poppins/Poppins-LightItalic.ttf
new file mode 100644
index 0000000..9e70be6
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-LightItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Medium.ttf b/assets/fonts/Poppins/Poppins-Medium.ttf
new file mode 100644
index 0000000..6bcdcc2
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Medium.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-MediumItalic.ttf b/assets/fonts/Poppins/Poppins-MediumItalic.ttf
new file mode 100644
index 0000000..be67410
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-MediumItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Regular.ttf b/assets/fonts/Poppins/Poppins-Regular.ttf
new file mode 100644
index 0000000..9f0c71b
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Regular.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-SemiBold.ttf b/assets/fonts/Poppins/Poppins-SemiBold.ttf
new file mode 100644
index 0000000..74c726e
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-SemiBold.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf b/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf
new file mode 100644
index 0000000..3e6c942
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-SemiBoldItalic.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-Thin.ttf b/assets/fonts/Poppins/Poppins-Thin.ttf
new file mode 100644
index 0000000..03e7366
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-Thin.ttf differ
diff --git a/assets/fonts/Poppins/Poppins-ThinItalic.ttf b/assets/fonts/Poppins/Poppins-ThinItalic.ttf
new file mode 100644
index 0000000..e26db5d
Binary files /dev/null and b/assets/fonts/Poppins/Poppins-ThinItalic.ttf differ
diff --git a/assets/images/book_1.jpg b/assets/images/book_1.jpg
new file mode 100644
index 0000000..c16ee91
Binary files /dev/null and b/assets/images/book_1.jpg differ
diff --git a/assets/images/book_2.jpg b/assets/images/book_2.jpg
new file mode 100644
index 0000000..3a819bb
Binary files /dev/null and b/assets/images/book_2.jpg differ
diff --git a/assets/images/book_3.jpg b/assets/images/book_3.jpg
new file mode 100644
index 0000000..20f7a3d
Binary files /dev/null and b/assets/images/book_3.jpg differ
diff --git a/assets/images/book_4.jpg b/assets/images/book_4.jpg
new file mode 100644
index 0000000..ab92eb6
Binary files /dev/null and b/assets/images/book_4.jpg differ
diff --git a/assets/images/person.png b/assets/images/person.png
new file mode 100644
index 0000000..5b3e321
Binary files /dev/null and b/assets/images/person.png differ
diff --git a/assets/images/preview_icon.svg b/assets/images/preview_icon.svg
new file mode 100644
index 0000000..9235d82
--- /dev/null
+++ b/assets/images/preview_icon.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/reviews_icon.svg b/assets/images/reviews_icon.svg
new file mode 100644
index 0000000..acdc168
--- /dev/null
+++ b/assets/images/reviews_icon.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/search.svg b/assets/images/search.svg
new file mode 100644
index 0000000..b7e87e2
--- /dev/null
+++ b/assets/images/search.svg
@@ -0,0 +1,3 @@
+
diff --git a/lib/controllers/book_controller.dart b/lib/controllers/book_controller.dart
new file mode 100644
index 0000000..3f58e71
--- /dev/null
+++ b/lib/controllers/book_controller.dart
@@ -0,0 +1,100 @@
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+
+import '../models/book.dart';
+import '../models/data.dart';
+import '../style.dart';
+import '../views/screens/cart_page.dart';
+import '../views/screens/home_page.dart';
+
+class BookController extends GetxController {
+ RxString searchResult = ('').obs;
+ String currentPage = 'home page';
+
+ void successfulBookPurchase(BuildContext context) => Get.snackbar(
+ 'Successful the book purchase',
+ 'Go to cart page to view your purchases',
+ icon: const Icon(CupertinoIcons.shopping_cart),
+ onTap: (GetSnackBar snackBar) {
+ Get.closeAllSnackbars();
+ Get.to(const CartPage());
+ },
+ );
+
+ void addBookSnackBar(BuildContext context, bool isSuccessfulAdd) => Get.snackbar(
+ isSuccessfulAdd ? 'The book has been successfully added' : 'Failed to add book',
+ isSuccessfulAdd ? 'Go to the home page to view the book added' : 'You have entered invalid data, please fill in the fields with valid data',
+ icon: const Icon(CupertinoIcons.add),
+ onTap: (GetSnackBar snackBar) {
+ if (isSuccessfulAdd) {
+ Get.closeAllSnackbars();
+ Get.to(const HomePage());
+ }
+ },
+ );
+
+ String get getHeaderText => searchResult.isNotEmpty ? 'Result' : 'Book List';
+ Color get getSVGSearchColor => searchResult.isNotEmpty ? blue : hintTextColor;
+
+ bool isBookStoreEmpty() => Data.books.isEmpty;
+ bool isNotFoundBooks() => filterBooks(searchResult.value).isEmpty;
+ bool isPurchasedBooksEmpty() => Data.purchasedBooks.isEmpty;
+ bool isFieldsEmpty(Map map) {
+ bool isInvaild = false;
+ for(String value in map.values){
+ if(value.contains(',')) isInvaild = true;
+ }
+ return map.containsValue('') || isInvaild;
+ }
+
+ void buyBook(Book book) => Data.purchasedBooks.add(book);
+ double getCorrectRating(double rating) {
+ String rate = rating.toString();
+ return double.parse(rate.substring(rate.length - 1, rate.length)) < 5
+ ? double.parse(rate.substring(0, 1))
+ : double.parse('${rate.substring(0, 1)}.5');
+ }
+
+ void addBook(Map newBook) {
+ double rating = getCorrectRating(double.parse(newBook['rating'].toString()));
+ Data.books.add(Book(
+ name: newBook['name'].toString(),
+ author: newBook['author'].toString(),
+ image: newBook['image'].toString(),
+ description: newBook['description'].toString(),
+ price: double.parse(newBook['price'].toString()),
+ rating: rating > 5 ? 5 : rating,
+ ));
+ }
+
+ Color iconcolorCurrentPage(String currentPage) {
+ return currentPage == this.currentPage ? black : unselectedIconColor;
+ }
+
+ List filterBooks(String nameBook) {
+ if (searchResult.isEmpty) return Data.books;
+ return Data.books
+ .where((e) => e.name.toLowerCase().contains(nameBook))
+ .toList();
+ }
+
+ List getBookRating(double rating) {
+ List icons = [];
+
+ for (int i = 0; i < 5; i++) {
+ icons.add(
+ Icon(
+ (rating-- >= 1.0)
+ ? (Icons.star)
+ : (rating == 0.5 || rating == -0.5
+ ? Icons.star_half
+ : Icons.star),
+ color: rating + 1 > 0 ? (iconsColor) : halfIconColor,
+ size: 14,
+ ),
+ );
+ }
+ return icons;
+ }
+}
diff --git a/lib/main.dart b/lib/main.dart
index bcc58f7..cce53fc 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,6 +1,18 @@
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:get/get.dart';
+
+import 'controllers/book_controller.dart';
+import 'views/screens/home_page.dart';
void main() {
+ SystemChrome.setSystemUIOverlayStyle(
+ const SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ statusBarIconBrightness: Brightness.dark,
+ ),
+ );
+
runApp(const MyApp());
}
@@ -9,12 +21,11 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return const MaterialApp(
- home: Scaffold(
- body: Center(
- child: Text("Book Store App"),
- ),
- ),
+ Get.put(BookController());
+ return const GetMaterialApp(
+ title: 'Book Store',
+ debugShowCheckedModeBanner: false,
+ home: HomePage(),
);
}
}
diff --git a/lib/models/book.dart b/lib/models/book.dart
new file mode 100644
index 0000000..70c8b9b
--- /dev/null
+++ b/lib/models/book.dart
@@ -0,0 +1,14 @@
+class Book {
+ String name, author, image, description;
+ double price, rating;
+
+ Book({
+ required this.name,
+ required this.author,
+ required this.image,
+ required this.description,
+ required this.price,
+ required this.rating,
+ });
+
+}
diff --git a/lib/models/data.dart b/lib/models/data.dart
new file mode 100644
index 0000000..44e7fa3
--- /dev/null
+++ b/lib/models/data.dart
@@ -0,0 +1,42 @@
+import 'package:get/get.dart';
+
+import 'book.dart';
+
+class Data{
+ static RxList books = [
+ Book(
+ name: 'Life A COMPILATION OF SHORT STORIES AND POETRY',
+ author: 'ZOE DAVIS',
+ image: 'assets/images/book_1.jpg',
+ description: 'Sit cillum aliqua in velit dolore nulla id ullamco occaecat exercitation quis laborum minim. Ea nulla occaecat do duis id et nulla aute officia enim tempor elit. Consequat ea ullamco sit proident sit sit do ea nulla veniam Lorem id. Irure in sint fugiat aliquip. Tempor qui aute quis tempor occaecat nulla id irure minim aute aute dolore esse. Sunt ut magna mollit do duis commodo incididunt ipsum duis enim enim.',
+ price: 65.99,
+ rating: 4.5,
+ ),
+ Book(
+ name: 'ULTRALEARNING',
+ author: 'Scott H. Young',
+ image: 'assets/images/book_2.jpg',
+ description: 'Elit magna velit culpa exercitation occaecat duis in eu sit sunt. Ipsum mollit do irure id. Incididunt occaecat nisi veniam occaecat do eiusmod sit.',
+ price: 69.99,
+ rating: 5.0,
+ ),
+ Book(
+ name: 'THE PROPHET',
+ author: 'Kahlil Gibran',
+ image: 'assets/images/book_3.jpg',
+ description: 'Duis consequat elit reprehenderit Lorem consequat in esse elit pariatur ut officia id sit sunt. Sit magna voluptate quis sunt ad adipisicing irure labore pariatur Lorem do minim proident irure. Ad quis excepteur ut ea sint ullamco quis nulla proident voluptate laboris. Dolore cupidatat sint nisi sint enim aute amet officia aute.',
+ price: 44.99,
+ rating: 4.0,
+ ),
+ Book(
+ name: 'THE POWER OF HABIT',
+ author: 'Charles Duhigg',
+ image: 'assets/images/book_4.jpg',
+ description: 'Et ea dolore proident officia ea elit ea sunt ut ullamco consectetur incididunt. Lorem dolor Lorem nostrud Lorem. In esse deserunt sunt dolore sit dolore est reprehenderit nostrud et. Eu enim ea mollit anim. Veniam aute sunt sunt est commodo fugiat ullamco labore mollit est.',
+ price: 89.99,
+ rating: 4.5,
+ ),
+ ].obs;
+
+ static RxList purchasedBooks = [].obs;
+}
\ No newline at end of file
diff --git a/lib/style.dart b/lib/style.dart
new file mode 100644
index 0000000..8361647
--- /dev/null
+++ b/lib/style.dart
@@ -0,0 +1,51 @@
+import 'package:flutter/material.dart';
+
+const Color white = Colors.white;
+const Color black = Colors.black;
+const Color blue = Colors.blue;
+const Color iconsColor = Color(0xffFFC41F);
+const Color hintTextColor = Color(0xff84889E);
+const Color halfIconColor = Color(0xffEDEDEF);
+const Color unselectedIconColor = Color(0xff9C9EA8);
+const Color shadowColor = Color.fromRGBO(7, 8, 14, 0.05);
+
+
+const TextStyle nameUserTextStyle = TextStyle(
+ color: black,
+ fontSize: 14,
+ fontWeight: FontWeight.w600,
+ fontFamily: 'Poppins-Regular',
+ fontStyle: FontStyle.normal,
+);
+
+const TextStyle hintTextStyle = TextStyle(
+ color: hintTextColor,
+ fontSize: 16,
+ fontWeight: FontWeight.w400,
+ fontFamily: 'Poppins',
+ fontStyle: FontStyle.normal,
+);
+
+const TextStyle headerTextStyle = TextStyle(
+ color: black,
+ fontSize: 24,
+ fontWeight: FontWeight.w600,
+ fontFamily: 'Poppins',
+ fontStyle: FontStyle.normal,
+);
+
+const TextStyle titleTextStyle = TextStyle(
+ color: black,
+ fontSize: 14,
+ fontWeight: FontWeight.w500,
+ fontFamily: 'Poppins',
+ fontStyle: FontStyle.normal,
+);
+
+const TextStyle buyButtonTextStyle = TextStyle(
+ color: white,
+ fontSize: 16,
+ fontWeight: FontWeight.w500,
+ fontFamily: 'Poppins',
+ fontStyle: FontStyle.normal,
+);
diff --git a/lib/views/screens/add_page.dart b/lib/views/screens/add_page.dart
new file mode 100644
index 0000000..a770c50
--- /dev/null
+++ b/lib/views/screens/add_page.dart
@@ -0,0 +1,52 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+
+import '../../controllers/book_controller.dart';
+import '../../style.dart';
+import '../widgets/add_page/add_new_book.dart';
+import '../widgets/custom_app_bar.dart';
+
+class AddPage extends StatefulWidget {
+ const AddPage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _AddPageState();
+}
+
+class _AddPageState extends State {
+ late final BookController bookController;
+
+ @override
+ void initState() {
+ super.initState();
+ bookController = Get.find();
+ bookController.currentPage = 'add page';
+ }
+
+ // @override
+ // void dispose() {
+ // bookController.dispose();
+ // super.dispose();
+ // }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ backgroundColor: white,
+ appBar: const CoustomAppBar(),
+ body: SizedBox(
+ height: MediaQuery.of(context).size.height,
+ width: MediaQuery.of(context).size.width,
+ child: SingleChildScrollView(
+ physics: const ScrollPhysics(),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: const [
+ AddNewBook(),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/views/screens/cart_page.dart b/lib/views/screens/cart_page.dart
new file mode 100644
index 0000000..d20373e
--- /dev/null
+++ b/lib/views/screens/cart_page.dart
@@ -0,0 +1,56 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+
+import '../../controllers/book_controller.dart';
+import '../../style.dart';
+import '../widgets/cart_page/purchased_list.dart';
+import '../widgets/custom_app_bar.dart';
+import '../widgets/custom_bottom_navigation_bar.dart';
+
+class CartPage extends StatefulWidget {
+ const CartPage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _CartPageState();
+}
+
+class _CartPageState extends State {
+ late final BookController bookController;
+
+ @override
+ void initState() {
+ super.initState();
+ bookController = Get.find();
+ bookController.currentPage = 'cart page';
+ }
+
+ // @override
+ // void dispose() {
+ // bookController.dispose();
+ // super.dispose();
+ // }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ resizeToAvoidBottomInset: false,
+ backgroundColor: white,
+ appBar: const CoustomAppBar(),
+ body: SizedBox(
+ height: MediaQuery.of(context).size.height,
+ width: MediaQuery.of(context).size.width,
+ child: SingleChildScrollView(
+ physics: const ScrollPhysics(),
+ child: Column(
+ children: const [
+ PurchasedList(),
+ SizedBox(height: 88),
+ ],
+ ),
+ ),
+ ),
+ floatingActionButton: const CustomBottomNavigationBar(),
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
+ );
+ }
+}
diff --git a/lib/views/screens/details_page.dart b/lib/views/screens/details_page.dart
new file mode 100644
index 0000000..bf2dfc1
--- /dev/null
+++ b/lib/views/screens/details_page.dart
@@ -0,0 +1,37 @@
+import 'package:flutter/material.dart';
+
+import '../../models/book.dart';
+import '../../style.dart';
+import '../widgets/custom_app_bar.dart';
+import '../widgets/details_page/all_deatails.dart';
+import '../widgets/details_page/book_photo.dart';
+
+class DetailsPage extends StatelessWidget {
+ const DetailsPage({Key? key, required this.book}) : super(key: key);
+
+ final Book book;
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ backgroundColor: white,
+ appBar: const CoustomAppBar(),
+ body: Container(
+ height: MediaQuery.of(context).size.height,
+ width: MediaQuery.of(context).size.width,
+ color: white,
+ child: SingleChildScrollView(
+ physics: const ScrollPhysics(),
+ child: Column(
+ children: [
+ const SizedBox(height: 12),
+ BookPhoto(image: book.image),
+ AllDetails(book: book),
+ const SizedBox(height: 12),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/views/screens/home_page.dart b/lib/views/screens/home_page.dart
new file mode 100644
index 0000000..5a063a0
--- /dev/null
+++ b/lib/views/screens/home_page.dart
@@ -0,0 +1,70 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+
+import '../../controllers/book_controller.dart';
+import '../../style.dart';
+import '../widgets/custom_bottom_navigation_bar.dart';
+import '../widgets/home_page/book_list.dart';
+import '../widgets/home_page/search_field.dart';
+import '../widgets/home_page/user_account.dart';
+
+class HomePage extends StatefulWidget {
+ const HomePage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _HomePageState();
+}
+
+class _HomePageState extends State {
+ late final BookController bookController;
+
+ @override
+ void initState() {
+ super.initState();
+ bookController = Get.find();
+ bookController.currentPage = 'home page';
+ }
+
+ // @override
+ // void dispose() {
+ // super.dispose();
+ // bookController.dispose();
+ // }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ resizeToAvoidBottomInset: false,
+ backgroundColor: white,
+ appBar: AppBar(
+ backgroundColor: white,
+ leadingWidth: 132,
+ leading: const UserAccount(),
+ actions: [
+ IconButton(
+ onPressed: () {},
+ icon: const Icon(Icons.more_vert),
+ color: black,
+ splashRadius: 20,
+ ),
+ ],
+ toolbarHeight: 64,
+ elevation: 0,
+ ),
+ body: SizedBox(
+ height: MediaQuery.of(context).size.height,
+ width: MediaQuery.of(context).size.width,
+ child: ListView(
+ physics: const ScrollPhysics(),
+ children: const [
+ SearchField(),
+ BookList(),
+ SizedBox(height: 88),
+ ],
+ ),
+ ),
+ floatingActionButton: const CustomBottomNavigationBar(),
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
+ );
+ }
+}
diff --git a/lib/views/widgets/add_page/add_new_book.dart b/lib/views/widgets/add_page/add_new_book.dart
new file mode 100644
index 0000000..e45e74e
--- /dev/null
+++ b/lib/views/widgets/add_page/add_new_book.dart
@@ -0,0 +1,136 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+
+import '../../../controllers/book_controller.dart';
+import '../../../style.dart';
+import '../primary_button.dart';
+import 'custom_text_field.dart';
+
+class AddNewBook extends StatefulWidget {
+ const AddNewBook({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _AddNewBookState();
+}
+
+class _AddNewBookState extends State {
+ late BookController bookController;
+ late TextEditingController nameBookController,
+ authorBookController,
+ priceBookController,
+ ratingBookController,
+ imageBookController,
+ descripationBookController;
+
+ @override
+ void initState() {
+ super.initState();
+ bookController = Get.find();
+ nameBookController = TextEditingController();
+ authorBookController = TextEditingController();
+ priceBookController = TextEditingController();
+ ratingBookController = TextEditingController();
+ imageBookController = TextEditingController();
+ descripationBookController = TextEditingController();
+ }
+
+ @override
+ void dispose() {
+ nameBookController.dispose();
+ authorBookController.dispose();
+ priceBookController.dispose();
+ ratingBookController.dispose();
+ imageBookController.dispose();
+ descripationBookController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ List