First Commit

This commit is contained in:
='fauz
2025-03-17 14:54:44 +07:00
commit 4e58e23d9b
193 changed files with 9041 additions and 0 deletions
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
class ListDetailScreen extends StatefulWidget {
final String title;
const ListDetailScreen({super.key, required this.title});
@override
State<ListDetailScreen> createState() => _ListDetailScreenState();
}
class _ListDetailScreenState extends State<ListDetailScreen> {
List<bool> checklist = [];
@override
void initState() {
super.initState();
checklist = List.generate(paragraphs.length, (index) => false);
}
final List<String> paragraphs = [
"Paragraf pertama tentang ${"widget.title"}.",
"Paragraf kedua dengan informasi tambahan.",
"Paragraf ketiga yang menjelaskan detail lebih lanjut.",
"Paragraf keempat yang melengkapi pembahasan.",
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: Text(widget.title)),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
// Gambar di kiri atas dengan teks di kanan
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
'images/default.png', // Ganti dengan gambar yang sesuai
width: 100,
height: 100,
fit: BoxFit.cover,
),
const SizedBox(width: 16),
Expanded(
child: Text(
"Ini adalah detail dari ${widget.title}.",
style: const TextStyle(fontSize: 18),
),
),
],
),
const SizedBox(height: 20),
// Paragraf dengan checklist
Expanded(
child: ListView.builder(
itemCount: paragraphs.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(paragraphs[index]),
trailing: Checkbox(
value: checklist[index],
onChanged: (bool? value) {
setState(() {
checklist[index] = value!;
});
},
),
);
},
),
),
],
),
),
);
}
}
+187
View File
@@ -0,0 +1,187 @@
import 'package:flutter/material.dart';
import 'package:furibase/components/buildcard_info.dart';
import 'package:furibase/components/main_menu.dart';
import 'package:furibase/screen/pustaka/pustaka_detail_screen.dart';
class ListEducation extends StatefulWidget {
const ListEducation({super.key});
@override
State<ListEducation> createState() => _ListEducationState();
}
class _ListEducationState extends State<ListEducation> {
TextEditingController searchController = TextEditingController();
List<String> allItems = [
"Matematika",
"Fisika",
"Kimia",
"Biologi",
"Sejarah",
"Geografi",
];
List<String> filteredItems = [];
@override
void initState() {
super.initState();
filteredItems = List.from(allItems);
}
void filterSearch(String query) {
setState(() {
filteredItems =
allItems
.where((item) => item.toLowerCase().contains(query.toLowerCase()))
.toList();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black26,
body: Column(
children: [
// Header Section
Container(
padding: const EdgeInsets.all(10),
color: Colors.grey.withOpacity(0.2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BuildcardInfo(
icon: Icons.person,
text: 'User01',
extraIcon: Icons.emoji_events,
extraText: "5000",
width: 180,
),
BuildcardInfo(
icon: Icons.monetization_on,
text: "1.300",
width: 90,
),
],
),
),
// Search Bar
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Container(
height: 47,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey.shade200,
),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
children: [
const Icon(
Icons.search,
color: Color.fromARGB(137, 180, 172, 172),
size: 18,
),
const SizedBox(width: 8),
Expanded(
child: TextField(
controller: searchController,
onChanged: filterSearch, // Memanggil filter saat mengetik
style: const TextStyle(color: Colors.black, fontSize: 14),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: 'Cari pelajaran...',
hintStyle: TextStyle(color: Colors.black54),
),
),
),
if (searchController.text.isNotEmpty)
IconButton(
icon: const Icon(Icons.close, color: Colors.black54),
onPressed: () {
searchController.clear();
filterSearch('');
},
),
],
),
),
),
// Collection Items dengan Filter
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child:
filteredItems.isEmpty
? const Center(
child: Text(
"Tidak ada hasil",
style: TextStyle(fontSize: 16, color: Colors.black54),
),
)
: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, // 2 Kolom
crossAxisSpacing: 20,
mainAxisSpacing: 20,
childAspectRatio: 2.5,
),
itemCount: filteredItems.length,
itemBuilder: (context, index) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
color: const Color.fromARGB(120, 255, 255, 255),
child: ListTile(
leading: Icon(
Icons.book,
color: const Color.fromARGB(255, 52, 16, 212),
),
title: Text(filteredItems[index]),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => ListDetailScreen(
title: filteredItems[index],
imagePath: filteredItems[index],
paragraphs: [
"""
<h1>Enter the main heading, usually the same as the title.</h1>
<p>Be <b>bold</b> in stating your key points. Put them in a list: </p>
<ul>
<li>The first item in your list</li>
<li>The second item; <i>italicize</i> key words</li>
</ul>
<p>Improve your image by including an image. </p>
<p><img src="https://via.placeholder.com/150" alt="A Great HTML Resource"></p>
<p>Add a link to your favorite <a href="https://www.dummies.com/">Web site</a>.</p>
<hr>
<p>Finally, link to <a href="page2.html">another page</a> in your own Web site.</p>
<p>© Wiley Publishing, 2011</p>
""",
],
),
),
);
},
),
);
},
),
),
),
// Bottom Navigation
// MainMenu(),
],
),
);
}
}
@@ -0,0 +1,244 @@
import 'package:flutter/material.dart';
import 'package:furibase/components/buildcard_info.dart';
import 'package:furibase/components/collection_container.dart';
class DetailScreen extends StatefulWidget {
final String title;
final String image;
final String description;
const DetailScreen({
super.key,
required this.title,
required this.image,
required this.description,
});
@override
State<DetailScreen> createState() => _DetailScreenState();
}
class _DetailScreenState extends State<DetailScreen> {
List<bool> _isChecked = [];
@override
void initState() {
super.initState();
_isChecked = List.generate(
widget.description.split("\n").length,
(index) => false,
);
}
@override
Widget build(BuildContext context) {
List<String> paragraphs = widget.description.split("\n");
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
widget.image,
width: 100,
height: 100,
fit: BoxFit.cover,
),
const SizedBox(width: 16),
Expanded(
child: ListView.builder(
itemCount: paragraphs.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
paragraphs[index],
style: const TextStyle(fontSize: 16),
),
trailing: Checkbox(
value: _isChecked[index],
onChanged: (bool? value) {
setState(() {
_isChecked[index] = value ?? false;
});
},
),
);
},
),
),
],
),
),
);
}
}
class PustakaScreen extends StatefulWidget {
const PustakaScreen({super.key});
@override
State<PustakaScreen> createState() => _PustakaScreenState();
}
class _PustakaScreenState extends State<PustakaScreen> {
final PageController _pageController = PageController();
int _selectedIndex = 0;
final TextEditingController _searchController = TextEditingController();
String _searchQuery = "";
final List<Map<String, String>> _collections = [
{
"label": "Luffy",
"image": "images/luffy.png",
"description":
"Karakter utama di One Piece.\nDia adalah bajak laut yang bercita-cita menjadi Raja Bajak Laut.",
},
{
"label": "Oni Chan",
"image": "images/klipartz.png",
"description":
"Karakter ikonik dari anime.\nIa dikenal karena sifatnya yang protektif dan penyayang.",
},
{
"label": "Cepot",
"image": "images/cepott.png",
"description":
"Tokoh wayang golek terkenal.\nCepot dikenal dengan lelucon dan kebijaksanaannya.",
},
{
"label": "Cepot",
"image": "images/cepott.png",
"description":
"Tokoh wayang golek terkenal.\nCepot dikenal dengan lelucon dan kebijaksanaannya.",
},
];
void _onMenuTapped(int index) {
setState(() {
_selectedIndex = index;
});
_pageController.animateToPage(
index,
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
}
@override
Widget build(BuildContext context) {
List<Map<String, String>> filteredCollections =
_collections
.where(
(item) => item["label"]!.toLowerCase().contains(
_searchQuery.toLowerCase(),
),
)
.toList();
return Scaffold(
body: Column(
children: [
Container(
padding: const EdgeInsets.all(10),
color: const Color.fromARGB(251, 122, 129, 121).withOpacity(0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BuildcardInfo(
icon: Icons.person,
text: 'User01',
extraIcon: Icons.emoji_events,
extraText: "5000",
width: 180,
),
BuildcardInfo(
icon: Icons.monetization_on,
text: "1.300",
width: 90,
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Text(
DateTime.now().toString(),
style: const TextStyle(color: Colors.white),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 10),
child: Container(
height: 47,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: const Color.fromARGB(50, 237, 227, 227),
),
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
children: [
const Icon(Icons.search, color: Colors.black54, size: 18),
const SizedBox(width: 8),
Expanded(
child: TextField(
controller: _searchController,
onChanged: (value) {
setState(() {
_searchQuery = value;
});
},
style: const TextStyle(color: Colors.black, fontSize: 12),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: 'Search...',
hintStyle: TextStyle(color: Colors.grey),
),
),
),
],
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 120,
vertical: 40,
),
child: GridView.count(
crossAxisCount: 2,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
children:
filteredCollections.map((item) {
return CollectionContainer(
label: item["label"]!,
imagesrc: item["image"]!,
width: 100,
height: 100,
onTapAc:
() => {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => DetailScreen(
title: item["label"]!,
image: item["image"]!,
description: item["description"]!,
),
),
),
},
);
}).toList(),
),
),
),
],
),
);
}
}
@@ -0,0 +1,136 @@
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
class ListDetailScreen extends StatefulWidget {
final String title;
final String imagePath;
final List<String> paragraphs;
const ListDetailScreen({
Key? key,
required this.title,
required this.imagePath,
required this.paragraphs,
}) : super(key: key);
@override
_ListDetailScreenState createState() => _ListDetailScreenState();
}
class _ListDetailScreenState extends State<ListDetailScreen> {
late List<bool> _readStatus;
@override
void initState() {
super.initState();
_readStatus = List.generate(widget.paragraphs.length, (index) => false);
}
void _toggleReadStatus(int index) {
setState(() {
_readStatus[index] = !_readStatus[index];
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: Text(widget.title)),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
widget.imagePath,
width: 100,
height: 100,
fit: BoxFit.cover,
),
const SizedBox(width: 16),
Expanded(
child: Text(
widget.title,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
],
),
const SizedBox(height: 16),
Expanded(
child: ListView.builder(
itemCount: widget.paragraphs.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child:
// Text(
// widget.paragraphs[index] +
// style: TextStyle(color: Colors.black),
Html(
style: {"body": Style(color: Colors.black)},
data:
widget.paragraphs.toString() +
"""
<html>
<!-- Text between angle brackets is an HTML tag and is not displayed.
Most tags, such as the HTML and /HTML tags that surround the contents of
a page, come in pairs; some tags, like HR, for a horizontal rule, stand
alone. Comments, such as the text you're reading, are not displayed when
the Web page is shown. The information between the HEAD and /HEAD tags is
not displayed. The information between the BODY and /BODY tags is displayed.-->
<head>
<title>Enter a title, displayed at the top of the window.</title>
</head>
<!-- The information between the BODY and /BODY tags is displayed.-->
<body>
<h1>Enter the main heading, usually the same as the title.</h1>
<p>Be <b>bold</b> in stating your key points. Put them in a list: </p>
<ul>
<li>The first item in your list</li>
<li>The second item; <i>italicize</i> key words</li>
</ul>
<p>Improve your image by including an image. </p>
<p><img src="http://www.mygifs.com/CoverImage.gif" alt="A Great HTML Resource"></p>
<p>Add a link to your favorite <a href="https://www.dummies.com/">Web site</a>.
Break up your page with a horizontal rule or two. </p>
<hr>
<p>Finally, link to <a href="page2.html">another page</a> in your own Web site.</p>
<!-- And add a copyright notice.-->
<p>© Wiley Publishing, 2011</p>
</body>
</html>
""",
),
),
// ),
// Checkbox(
// value: _readStatus[index],
// onChanged: (bool? value) {
// _toggleReadStatus(index);
// },
// ),
],
),
);
},
),
),
],
),
),
);
}
}