Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diyar Hussein #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
69 changes: 69 additions & 0 deletions lib/about_books/book_details_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import 'package:flutter/material.dart';

import '../app_bars/the_app_bar2.dart';
import '../model.dart';
import '../my_buttons/button2.dart';
import 'book_img.dart';
import 'details_of_books.dart';

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

final Book book;

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: const Color.fromARGB(255, 245, 245, 245),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const MyAppBar2(),
BookImg(book: book),
MyBookDetails(book: book),
Stack(children: [
Column(
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Button2(icon: Icons.menu_outlined, text: 'Preview',),
Button2(icon: Icons.comment_outlined, text: 'Reviews',),
],
),
TextButton(
onPressed: () {
Book.cartBooks.add(book);
},
child: Container(
width: 335,
height: 60,
margin: const EdgeInsets.symmetric(vertical: 20),
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black),
child: Text(
'Buy Now for ${book.price}',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
),
],
),
],),
],
),
),
),
);
}
}
28 changes: 28 additions & 0 deletions lib/about_books/book_img.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';

import '../model.dart';

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

final Book book;

@override
Widget build(BuildContext context) {
return Expanded(
flex: 5,
child: Container(
margin: const EdgeInsets.symmetric(vertical: 20),
width: 250,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(book.imageUrl.toString()),
fit: BoxFit.cover),
borderRadius: BorderRadius.circular(10)),
),
);
}
}
82 changes: 82 additions & 0 deletions lib/about_books/details_of_books.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';

import '../model.dart';

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

final Book book;

@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.bookName,
style: const TextStyle(
fontSize: 26,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.author,
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.normal,
),
),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
for (var i = 0; i < 4; i++)
const Padding(
padding: EdgeInsets.only(right: 2),
child: Icon(Icons.star, size: 16, color: Colors.orange),
),
const Icon(Icons.star, size: 16, color: Colors.grey),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 5),
child: Text(
'4.0/5.0',
style: TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
)
]),
),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(
book.description,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
fontWeight: FontWeight.normal,
),
),
),
],
),
),
);
}
}
112 changes: 112 additions & 0 deletions lib/add_book_page/add_book.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import 'package:flutter/material.dart';

import '../app_bars/the_app_bar2.dart';
import '../model.dart';
import '../my_text_fields/the_text_field2.dart';

class AddBook extends StatefulWidget {
const AddBook({
Key? key,
}) : super(key: key);

@override
State<AddBook> createState() => _AddBookState();
}

class _AddBookState extends State<AddBook> {
final bookName = TextEditingController();
final authorName = TextEditingController();
final price = TextEditingController();
final description = TextEditingController();
final imageLink = TextEditingController();

@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: const Color.fromARGB(255, 245, 245, 245),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
const MyAppBar2(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Padding(
padding: EdgeInsets.only(bottom: 20),
child: Text(
'Add Book',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
MyTextField2(
hint: 'Book Name..',
maxlines: 1,
mycontroller: bookName,
),
MyTextField2(
hint: 'Author Name..',
maxlines: 1,
mycontroller: authorName,
),
MyTextField2(
hint: 'Book Price..',
maxlines: 1,
mycontroller: price,
),
MyTextField2(
hint: 'Image Link..',
maxlines: 1,
mycontroller: imageLink,
),
MyTextField2(
hint: 'Book Description..',
maxlines: 5,
mycontroller: description,
),
TextButton(
onPressed: () {
Book book = Book(
bookName.text,
authorName.text,
description.text,
price.text,
imageLink.text,
);
Book.books.add(book);
},
child: Container(
width: 335,
height: 60,
margin: const EdgeInsets.symmetric(vertical: 20),
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black),
child: const Text(
'Add',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
),
],
),
)
],
),
),),
);
}
}
38 changes: 38 additions & 0 deletions lib/app_bars/the_app_bar2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
size: 24,
color: Colors.black,
),
),
TextButton(
onPressed: () {},
child: const Icon(
Icons.more_vert,
size: 26,
color: Colors.black,
),
),
],
),
);
}
}
33 changes: 33 additions & 0 deletions lib/app_bars/the_appbar1.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
margin: const EdgeInsets.only(right: 10),
width: 40,
height: 40,
decoration: BoxDecoration(
// image: const DecorationImage(
// image: AssetImage('assets/profile.png'), fit: BoxFit.cover),
borderRadius: BorderRadius.circular(10)),
),
const Expanded(
child: Text(
'Hello Diyar',
style: TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black),
),
),
const Icon(Icons.more_vert, size: 24, color: Colors.black)
],
);
}
}
Loading