This commit is contained in:
='fauz
2025-04-09 16:28:42 +07:00
commit 64e1abb8db
199 changed files with 10265 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!;
});
},
),
);
},
),
),
],
),
),
);
}
}
+338
View File
@@ -0,0 +1,338 @@
import 'package:flutter/material.dart';
import 'package:furibase/components/buildcard_info.dart';
import 'package:furibase/components/card_list.dart';
import 'package:furibase/components/collection_container%20copy.dart';
import 'package:furibase/components/main_menu.dart';
import 'package:furibase/components/topbar_container.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) {
String _searchQuery = "";
final List<Map<String, String>> _collections = [
{"label": "Kesehatan", "image": "icons/healthy.svg"},
{"label": "Gizi", "image": "icons/Nutrition.svg"},
{"label": "Pendidikan", "image": "icons/Education.svg"},
{"label": "Keselamatan", "image": "icons/Safety.svg"},
];
List<Map<String, String>> filteredCollections =
_collections
.where(
(item) => item["label"]!.toLowerCase().contains(
_searchQuery.toLowerCase(),
),
)
.toList();
return Scaffold(
appBar: AppBar(
backgroundColor: Color.fromARGB(225, 79, 76, 182),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => Navigator.of(context).pop(false),
),
actions: <Widget>[],
),
backgroundColor: Colors.black26,
body: Column(
children: [
// Header Section
Container(
width: MediaQuery.of(context).size.width,
height: 165,
decoration: BoxDecoration(
color: const Color.fromARGB(225, 79, 76, 182),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25),
bottomRight: Radius.circular(25),
),
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 20,
),
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('');
},
),
],
),
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children:
filteredCollections.map((item) {
return CollectionContainer(
label: item["label"]!,
imageSvg: item["image"]!,
iconw: 60,
iconh: 60,
width: 70,
height: 70,
circle: false,
textColor: Colors.black,
lblSize: 10,
onTapAc:
() => {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ListEducation(),
),
),
},
);
}).toList(),
),
],
),
),
// 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
SizedBox(height: 20),
Expanded(
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(224, 145, 145, 155),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
child: Column(
children: [
SizedBox(height: 5),
Padding(
padding: EdgeInsets.symmetric(
horizontal: MediaQuery.of(context).size.width / 4,
),
child: Divider(
color: const Color.fromARGB(255, 155, 147, 147),
height: 20,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
// vertical: 10,
),
child:
filteredItems.isEmpty
? const Center(
child: Text(
"Tidak ada hasil",
style: TextStyle(
fontSize: 16,
color: Colors.black54,
),
),
)
: Padding(
padding: EdgeInsets.only(
top: 20.0,
left: 20,
right: 20,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
color: const Color.fromARGB(
255,
222,
181,
133,
),
),
child: Padding(
padding: EdgeInsets.only(
top: 12,
right: 20,
left: 20,
),
child: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1, // 2 Kolom
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: 2.5,
),
itemCount: filteredItems.length,
itemBuilder: (context, index) {
return GestureDetector(
child: CardList(),
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,155 @@
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),
backgroundColor: Color.fromARGB(225, 79, 76, 182),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(40),
bottomRight: Radius.circular(40),
),
color: Color.fromARGB(225, 79, 76, 182),
),
),
),
Padding(
padding: const EdgeInsets.all(20.0),
child: 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: Padding(
padding: const EdgeInsets.all(18.0),
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);
// },
// ),
],
),
);
},
),
),
),
],
),
// ),
);
}
}