Skip to content

Commit

Permalink
Merge branch 'dev' into review
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalkindi authored Dec 8, 2023
2 parents d6e16ce + 9de753c commit f5eba59
Show file tree
Hide file tree
Showing 35 changed files with 1,116 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
with:
allowUpdates: true
artifacts: "build/app/outputs/flutter-apk/*.apk"
body: "Published at ${{ steps.date.outputs.date }}"
name: "v${{ steps.version.outputs.version }}"
body: "A new version of the letterbookd app"
name: "letterbookd v${{ steps.version.outputs.version }}"
token: ${{ secrets.GH_TOKEN }}
tag: ${{ steps.version.outputs.version }}
Binary file added assets/images/pfp_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
29 changes: 29 additions & 0 deletions lib/catalog/models/book.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// sekedar buat test

// ignore_for_file: non_constant_identifier_names

class Book {
int isbn13;
String title;
String authors;
String categories;
String thumbnail;
String description;
int published_year;
int page_count;
int overall_rating; //sementara int dulu, gatau kenapa kalo pake Float dia tu parameternya error
int favorites_count;

Book(
this.isbn13,
this.title,
this.authors,
this.categories,
this.thumbnail,
this.description,
this.published_year,
this.page_count,
this.overall_rating,
this.favorites_count,
);
}
Empty file removed lib/catalog/models/librarian.dart
Empty file.
153 changes: 146 additions & 7 deletions lib/catalog/screens/catalog_home.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,155 @@
import 'package:flutter/material.dart';
import 'package:letterbookd/catalog/models/book.dart';
import 'package:letterbookd/catalog/screens/detail_book.dart';
import 'package:letterbookd/catalog/widgets/book_tile.dart';

/// ini contoh
class CatalogHome extends StatelessWidget {
const CatalogHome({super.key});
// class CatalogHome extends StatelessWidget {
// const CatalogHome({super.key});

// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: const Text("Catalog"),
// ),
// body: const Center(child: Text("Halaman utama Catalog")),
// );
// }
// }

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

@override
State<CatalogHome> createState() => _CatalogHomeState();
}

class _CatalogHomeState extends State<CatalogHome> {
Future<List<Book>> fetchBook() async {
// sementara dulu, karena belum integrasi dgn django
List<Book> books = [
Book(
9780002005883,
"Gilead",
"Marilynne Robinson",
"Fiction",
"http://books.google.com/books/content?id=KQZCPgAACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
2004,
247,
0,
0),
Book(
9780002261982,
"Spider's Web",
"Charles Osborne;Agatha Christie",
"Detective and mystery stories",
"http://books.google.com/books/content?id=gA5GPgAACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
2000,
241,
0,
0),
Book(
9780006163831,
"The One Tree",
"Stephen R. Donaldson",
"American fiction",
"http://books.google.com/books/content?id=OmQawwEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
1982,
479,
0,
0),
Book(
9780006178736,
"Rage of angels",
"Sidney Sheldon",
"Fiction",
"http://books.google.com/books/content?id=FKo2TgANz74C&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
1993,
512,
0,
0),
Book(
9780006280897,
"The Four Loves",
"Clive Staples Lewis",
"Christian life",
"http://books.google.com/books/content?id=XhQ5XsFcpGIC&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
2002,
170,
0,
0),
Book(
9780006280934,
"The Problem of Pain",
"Clive Staples Lewis",
"Christian life",
"http://books.google.com/books/content?id=Kk-uVe5QK-gC&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
2002,
176,
0,
0),
Book(
9780006353287,
"An Autobiography",
"Agatha Christie",
"Authors, English",
"http://books.google.com/books/content?id=c49GQwAACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api",
"Lorem ipsum dolor sit amet. Sit tenetur vero ad expedita eaque ut maiores aperiam At architecto doloremque est tenetur eveniet. Vel vitae voluptatem et ipsa perferendis At odit voluptas ut reiciendis consequuntur.",
1977,
560,
0,
0),
];

return books;
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Catalog"),
),
body: const Center(child: Text("Halaman utama Catalog")),
);
appBar: AppBar(
title: const Text('Catalog'),
),
// drawer: const LeftDrawer(),
body: FutureBuilder(
future: fetchBook(),
builder: (context, AsyncSnapshot snapshot) {
if (snapshot.data == null) {
return const Center(child: CircularProgressIndicator());
} else {
if (!snapshot.hasData) {
return const Column(
children: [
Text(
"Tidak ada data buku.",
style:
TextStyle(color: Color(0xff59A5D8), fontSize: 20),
),
SizedBox(height: 8),
],
);
} else {
return ListView.builder(
itemCount: snapshot.data!.length,
itemBuilder: (_, index) => InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return DetailBookPage(
book: snapshot.data![index]);
}));
},
child: BookTile(book: snapshot.data![index]),
));
}
}
}));
}
}
103 changes: 103 additions & 0 deletions lib/catalog/screens/detail_book.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import 'package:flutter/material.dart';
import 'package:letterbookd/catalog/models/book.dart';
import 'package:letterbookd/main.dart';

// nanti ganti jadi book.fields.[data]

class DetailBookPage extends StatelessWidget {
final Book book;

const DetailBookPage({Key? key, required this.book}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Book Detail'),
),
// drawer: const LeftDrawer(),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: SizedBox(
width: 200,
child: AspectRatio(
aspectRatio: AppData().bookAspectRatio,
child: Image.network(book.thumbnail, fit: BoxFit.fitWidth),
),
)),
const SizedBox(height: 30.0),
Text(
book.title,
style: const TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20.0),
Text(
'ISBN: ${book.isbn13}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
Text(
'Authors: ${book.authors.split(';').map((author) => author).join(', ')}',
style: const TextStyle(fontSize: 18.0),
),
const SizedBox(height: 15.0),
Text(
'Categories: ${book.categories}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
Text(
'Publised year: ${book.published_year}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
Text(
'Page count: ${book.page_count}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
Text(
'Overall rating: ${book.overall_rating}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
Text(
'Favorites count: ${book.favorites_count}',
style: const TextStyle(
fontSize: 18.0,
),
),
const SizedBox(height: 15.0),
const Text(
'Description:',
style: TextStyle(fontSize: 18.0),
),
const SizedBox(height: 8.0),
Text(
book.description,
style: const TextStyle(fontSize: 18.0),
),
const SizedBox(height: 30.0),
],
),
),
);
}
}
Loading

0 comments on commit f5eba59

Please sign in to comment.