Skip to content
Open
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
53 changes: 53 additions & 0 deletions lib/add_page/add_butoon.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';

import '../home_page/books_main/books_model.dart';

class AddBookButton extends StatelessWidget {
const AddBookButton({
Key? key,
required this.nameController,
required this.authorController,
required this.priceController,
required this.rateController,
required this.imageController,
required this.descriptionController,
}) : super(key: key);

final TextEditingController nameController;
final TextEditingController authorController;
final TextEditingController priceController;
final TextEditingController rateController;
final TextEditingController imageController;
final TextEditingController descriptionController;

@override
Widget build(BuildContext context) {
return Center(
child: GestureDetector(onTap:(){BookData.add(
nameController.text,
authorController.text,
priceController.text,
double.parse(rateController.text),
imageController.text,
descriptionController.text);

nameController.clear();
authorController.clear();
priceController.clear();
rateController.clear();
imageController.clear();
descriptionController.clear();} ,
child: Container(width: 319,height: 60,
margin: EdgeInsets.only(top: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),color: Colors.black
),child: const Center(
child: Text('Add Book',
style: TextStyle(color: Colors.white,
fontWeight:FontWeight.bold,
fontSize: 16),),
),),
),
);
}
}
59 changes: 59 additions & 0 deletions lib/add_page/add_page_main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';

import '../home_page/books_main/books_model.dart';
import 'add_butoon.dart';
import 'my_text_fields.dart';

class AddPage extends StatelessWidget {
AddPage({Key? key,}) : super(key: key);

TextEditingController nameController = TextEditingController();
TextEditingController authorController = TextEditingController();
TextEditingController priceController = TextEditingController();
TextEditingController rateController = TextEditingController();
TextEditingController imageController = TextEditingController();
TextEditingController descriptionController = TextEditingController();
BookData? bookData;

@override
Widget build(BuildContext context){
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.white.withOpacity(0.1),
elevation: 0,
leading: IconButton(onPressed: (){Navigator.pop(context);},
icon:const Icon(Icons.arrow_back_ios_new_sharp,
color: Colors.black, size: 25,),),
actions: const [
Icon(Icons.more_vert_sharp, color: Colors.black, size: 25,)
],
),
body: ListView(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 50),
child: Column(crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Add Book',style: TextStyle(fontSize:
24,fontWeight: FontWeight.bold),),
AddNameField(nameController: nameController),
AddAuthorField(authorController: authorController),
AddPriceField(priceController: priceController),
AddRatingField(rateController: rateController),
AddImageField(imageController: imageController),
AddDescriptionField(descriptionController: descriptionController),
AddBookButton(nameController: nameController,
authorController: authorController,
priceController: priceController,
rateController: rateController,
imageController: imageController,
descriptionController: descriptionController)
],
),
),
],
),
),
);
}}
235 changes: 235 additions & 0 deletions lib/add_page/my_text_fields.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@


import 'package:flutter/material.dart';

class AddNameField extends StatelessWidget {
const AddNameField({
Key? key,
required this.nameController,
}) : super(key: key);

final TextEditingController nameController;

@override
Widget build(BuildContext context) {
return Container(height: 60,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: Center(
child: TextField(
controller: nameController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Book Name",
hintStyle: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.grey)
),
),
)
);
}
}


class AddAuthorField extends StatelessWidget {
const AddAuthorField({
Key? key,
required this.authorController,
}) : super(key: key);

final TextEditingController authorController;

@override
Widget build(BuildContext context) {
return Container(height: 60,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: Center(
child: TextField(
controller: authorController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Author Name",
hintStyle: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.grey)
),
),
)
);
}
}


class AddPriceField extends StatelessWidget {
const AddPriceField({
Key? key,
required this.priceController,
}) : super(key: key);

final TextEditingController priceController;

@override
Widget build(BuildContext context) {
return Container(height: 60,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: Center(
child: TextField(
controller: priceController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Price",
hintStyle: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.grey)
),
),
)
);
}
}


class AddRatingField extends StatelessWidget {
const AddRatingField({
Key? key,
required this.rateController,
}) : super(key: key);

final TextEditingController rateController;

@override
Widget build(BuildContext context) {
return Container(height: 60,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: Center(
child: TextField(
controller: rateController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Rating",
hintStyle: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.grey)
),
),
)
);
}
}


class AddImageField extends StatelessWidget {
const AddImageField({
Key? key,
required this.imageController,
}) : super(key: key);

final TextEditingController imageController;

@override
Widget build(BuildContext context) {
return Container(height: 60,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: Center(
child: TextField(
controller: imageController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Image link",
hintStyle: TextStyle(fontSize: 17, fontWeight: FontWeight.w500, color: Colors.grey)
),
),
)
);
}
}


class AddDescriptionField extends StatelessWidget {
const AddDescriptionField({
Key? key,
required this.descriptionController,
}) : super(key: key);

final TextEditingController descriptionController;

@override
Widget build(BuildContext context) {
return Container(height: 100,
margin: const EdgeInsets.only(top: 40, left: 20, right: 20),
padding: EdgeInsets.symmetric(horizontal: 15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(196,135,198,.2),
blurRadius: 10,
offset: Offset(0,.1),
)
]
),
child: TextField(
controller: descriptionController,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: "Description",
hintStyle: TextStyle(fontSize: 17,
fontWeight: FontWeight.w500, color: Colors.grey)
),
)
);
}
}
34 changes: 34 additions & 0 deletions lib/book_page/book_page_buttons/book_all_buttons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';

import '../../home_page/books_main/books_model.dart';
import 'book_buy_button.dart';
import 'book_preview_button.dart';
import 'book_reviews_button.dart';

class BookPageButton extends StatelessWidget {
const BookPageButton({
Key? key,
required this.book,
}) : super(key: key);

final BookData book;

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Column(
children: [
Row(mainAxisAlignment: MainAxisAlignment.center,
children: const [
PreviewButton(),
SizedBox(width: 13,),
ReviewsButton()
],
),const SizedBox(height: 34,),
BuyButton(book: book)
],
),
);
}
}
Loading