Compare commits

..
14 Commits
107 changed files with 1853 additions and 4014 deletions
+9 -1
View File
@@ -43,4 +43,12 @@ app.*.map.json
/android/app/debug /android/app/debug
/android/app/profile /android/app/profile
/android/app/release /android/app/release
pubspec.lock
# Place unity project here
/unity
# flutter will place unity Library dependency here
/unityLibrary
# unityLibrary will place build here
/android/unityLibrary
+233 -10
View File
@@ -1,16 +1,239 @@
# furibase # Furikake App
A new Flutter project. Project ini adalah aplikasi mobile Furikake.
## Getting Started ## Konfiguras dan perubahan android app
This project is a starting point for a Flutter application. Edit android/app/src/main/kotlin ... /MainActivity.kt
A few resources to get you started if this is your first Flutter project: ```
package com.paj.freekake
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) import io.flutter.embedding.android.FlutterActivity
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) import io.flutter.embedding.android.FlutterFragmentActivity;
For help getting started with Flutter development, view the //class MainActivity : FlutterActivity()
[online documentation](https://docs.flutter.dev/), which offers tutorials, class MainActivity: FlutterFragmentActivity() {
samples, guidance on mobile development, and a full API reference. }
```
Gunakan konfigurasi ini pada file android/settings.gradle.kts
```
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
}
include(":app")
include(":unityLibrary")
project(":unityLibrary").projectDir = file("./unityLibrary")
include(":unityLibrary:xrmanifest.androidlib")
//project(":unityLibrary:xrmanifest.androidlib").projectDir = file("unityLibrary/xrmanifest.androidlib")
//include(":unityLibrary:mobilenotifications.androidlib")
//project(":unityLibrary:mobilenotifications.androidlib").projectDir = file("unityLibrary/mobilenotifications.androidlib")
```
Gunakan konfigurasi ini pada android/app/build.gradle.kts
```
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.paj.freekake"
//compileSdk = flutter.compileSdkVersion
compileSdk = 35
//ndkVersion = "27.0.12077973"
//ndkVersion = flutter.ndkVersion
ndkVersion = "23.1.7779620"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.paj.freekake"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
//minSdk = flutter.minSdkVersion
//targetSdk = flutter.targetSdkVersion
//minSdk = 24 // Set to 24 or higher
minSdk = 30
targetSdk = 35
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source = "../.."
}
dependencies {
implementation(project(":unityLibrary"))
implementation(project(":flutter_unity_widget"))
}
```
## Konfigurasi UnityLibrary
Gunakan konfigurasi ini pada file android/unityLibrary/build.gradle:
```
apply plugin: 'com.android.library'
dependencies {
implementation(name: 'unity-classes', ext:'jar')
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'UnityARCore', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation project('xrmanifest.androidlib')
//implementation project('mobilenotifications.androidlib')
}
android {
namespace "com.unity3d.player"
// ndkPath "/Applications/Unity/Hub/Editor/2022.3.60f1/PlaybackEngines/AndroidPlayer/NDK"
compileSdkVersion 35
buildToolsVersion '34.0.0'
ndkVersion "23.1.7779620"
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion 30
targetSdkVersion 35
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
versionCode 1
versionName '1.0.2'
consumerProguardFiles 'proguard-unity.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp']
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
jniLibs {
useLegacyPackaging true
}
}
}
def getSdkDir() {
Properties local = new Properties()
local.load(new FileInputStream("${rootDir}/local.properties"))
return local.getProperty('sdk.dir')
}
def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) {
def commandLineArgs = []
commandLineArgs.add("--compile-cpp")
commandLineArgs.add("--platform=Android")
commandLineArgs.add("--architecture=" + architecture)
commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so")
commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi)
commandLineArgs.add("--incremental-g-c-time-slice=3")
commandLineArgs.add("--dotnetprofile=unityaot-linux")
commandLineArgs.add("--enable-debugger")
commandLineArgs.add("--profiler-report")
commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents")
commandLineArgs.add("--print-command-line")
commandLineArgs.add("--data-folder=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput/data")
commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput")
commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache")
commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory)
staticLibraries.eachWithIndex {fileName, i->
commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName)
}
def executableExtension = ""
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
executableExtension = ".exe"
commandLineArgs = commandLineArgs*.replace('\"', '\\\"')
}
exec {
executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension
args commandLineArgs
environment "ANDROID_SDK_ROOT", getSdkDir()
}
delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so"
ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
}
android {
task BuildIl2CppTask {
doLast {
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'armv7', 'armeabi-v7a', [ ] as String[]);
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'arm64', 'arm64-v8a', [ ] as String[]);
}
}
afterEvaluate {
if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
}
sourceSets {
main {
jni.srcDirs = ["src/main/Il2CppOutputProject"]
}
}
}
```
+13 -10
View File
@@ -9,26 +9,28 @@ android {
namespace = "com.example.furibase" namespace = "com.example.furibase"
//compileSdk = flutter.compileSdkVersion //compileSdk = flutter.compileSdkVersion
compileSdk = 35 compileSdk = 35
ndkVersion = "27.0.12077973" //ndkVersion = "27.0.12077973"
//ndkVersion = flutter.ndkVersion //ndkVersion = flutter.ndkVersion
ndkVersion = "23.1.7779620"
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
kotlinOptions { kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString() jvmTarget = JavaVersion.VERSION_17.toString()
} }
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.furibase" applicationId = "com.paj.freekake"
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
//minSdk = flutter.minSdkVersion //minSdk = flutter.minSdkVersion
//targetSdk = flutter.targetSdkVersion //targetSdk = flutter.targetSdkVersion
minSdk = 24 // Set to 24 or higher //minSdk = 24 // Set to 24 or higher
minSdk = 30
targetSdk = 35 targetSdk = 35
versionCode = flutter.versionCode versionCode = flutter.versionCode
versionName = flutter.versionName versionName = flutter.versionName
@@ -41,12 +43,13 @@ android {
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("debug")
} }
} }
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("com.google.android.material:material:1.6.1")
}
} }
flutter { flutter {
source = "../.." source = "../.."
} }
dependencies {
implementation(project(":unityLibrary"))
implementation(project(":flutter_unity_widget"))
}
+1 -6
View File
@@ -2,8 +2,6 @@
<application <application
android:label="furibase" android:label="furibase"
android:name="${applicationName}" android:name="${applicationName}"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@@ -13,8 +11,7 @@
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize">
android:screenOrientation="portrait">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues while the Flutter UI initializes. After that, this theme continues
@@ -47,6 +44,4 @@
</queries> </queries>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
</manifest> </manifest>
@@ -1,5 +1,8 @@
package com.example.furibase package com.example.furibase
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity;
class MainActivity : FlutterActivity() //class MainActivity : FlutterActivity()
class MainActivity: FlutterFragmentActivity() {
}
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
+39
View File
@@ -1,5 +1,11 @@
allprojects { allprojects {
repositories { repositories {
flatDir {
dirs(
file("${project(":unityLibrary").projectDir}/libs")
)
}
google() google()
mavenCentral() mavenCentral()
} }
@@ -12,6 +18,39 @@ subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir) project.layout.buildDirectory.value(newSubprojectBuildDir)
} }
subprojects {
afterEvaluate {
if (project.extensions.findByName("android") != null) {
extensions.configure<com.android.build.gradle.BaseExtension>("android") {
if (namespace == null) {
namespace = project.group.toString()
}
}
}
if (plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) {
if (name == "flutter_unity_widget") {
extensions.configure<com.android.build.gradle.BaseExtension>("android") {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
(this as ExtensionAware).extensions.configure<org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions>("kotlinOptions") {
jvmTarget = "17"
}
if (namespace == null) {
namespace = project.group.toString()
}
compileSdkVersion(35)
}
}
}
}
}
subprojects { subprojects {
project.evaluationDependsOn(":app") project.evaluationDependsOn(":app")
} }
+2 -1
View File
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError # org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
+23 -1
View File
@@ -18,8 +18,30 @@ pluginManagement {
plugins { plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0" id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.0" apply false id("com.android.application") version "8.9.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false id("org.jetbrains.kotlin.android") version "1.8.22" apply false
} }
include(":app") include(":app")
include(":unityLibrary")
project(":unityLibrary").projectDir = file("./unityLibrary")
include(":unityLibrary:xrmanifest.androidlib")
// project(":unityLibrary:xrmanifest.androidlib").projectDir = file("unityLibrary/xrmanifest.androidlib")
// include(":unityLibrary:mobilenotifications.androidlib")
// project(":unityLibrary:mobilenotifications.androidlib").projectDir = file("unityLibrary/mobilenotifications.androidlib")
include(":unityLibrary")
project(":unityLibrary").projectDir = file("./unityLibrary")
include(":unityLibrary")
project(":unityLibrary").projectDir = file("./unityLibrary")
include(":unityLibrary")
project(":unityLibrary").projectDir = file("./unityLibrary")
+117
View File
@@ -0,0 +1,117 @@
apply plugin: 'com.android.library'
dependencies {
implementation(name: 'unity-classes', ext:'jar')
implementation(name: 'arcore_client', ext:'aar')
implementation(name: 'ARPresto', ext:'aar')
implementation(name: 'UnityARCore', ext:'aar')
implementation(name: 'unityandroidpermissions', ext:'aar')
implementation project('xrmanifest.androidlib')
//implementation project('mobilenotifications.androidlib')
}
android {
namespace "com.unity3d.player"
// ndkPath "/Applications/Unity/Hub/Editor/2022.3.60f1/PlaybackEngines/AndroidPlayer/NDK"
compileSdkVersion 35
buildToolsVersion '34.0.0'
ndkVersion "23.1.7779620"
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion 30
targetSdkVersion 35
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
versionCode 1
versionName '1.0.2'
consumerProguardFiles 'proguard-unity.txt'
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp']
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
doNotStrip '*/arm64-v8a/*.so'
jniLibs {
useLegacyPackaging true
}
}
}
def getSdkDir() {
Properties local = new Properties()
local.load(new FileInputStream("${rootDir}/local.properties"))
return local.getProperty('sdk.dir')
}
def BuildIl2Cpp(String workingDir, String configuration, String architecture, String abi, String[] staticLibraries) {
def commandLineArgs = []
commandLineArgs.add("--compile-cpp")
commandLineArgs.add("--platform=Android")
commandLineArgs.add("--architecture=" + architecture)
commandLineArgs.add("--outputpath=" + workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.so")
commandLineArgs.add("--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi)
commandLineArgs.add("--incremental-g-c-time-slice=3")
commandLineArgs.add("--dotnetprofile=unityaot-linux")
commandLineArgs.add("--enable-debugger")
commandLineArgs.add("--profiler-report")
commandLineArgs.add("--profiler-output-file=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_conv.traceevents")
commandLineArgs.add("--print-command-line")
commandLineArgs.add("--data-folder=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput/data")
commandLineArgs.add("--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput")
commandLineArgs.add("--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache")
commandLineArgs.add("--tool-chain-path=" + android.ndkDirectory)
staticLibraries.eachWithIndex {fileName, i->
commandLineArgs.add("--additional-libraries=" + workingDir + "/src/main/jniStaticLibs/" + abi + "/" + fileName)
}
def executableExtension = ""
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
executableExtension = ".exe"
commandLineArgs = commandLineArgs*.replace('\"', '\\\"')
}
exec {
executable workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp" + executableExtension
args commandLineArgs
environment "ANDROID_SDK_ROOT", getSdkDir()
}
delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so"
ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")
}
android {
task BuildIl2CppTask {
doLast {
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'armv7', 'armeabi-v7a', [ ] as String[]);
BuildIl2Cpp(projectDir.toString().replaceAll('\\\\', '/'), 'Debug', 'arm64', 'arm64-v8a', [ ] as String[]);
}
}
afterEvaluate {
if (project(':unityLibrary').tasks.findByName('mergeDebugJniLibFolders'))
project(':unityLibrary').mergeDebugJniLibFolders.dependsOn BuildIl2CppTask
if (project(':unityLibrary').tasks.findByName('mergeReleaseJniLibFolders'))
project(':unityLibrary').mergeReleaseJniLibFolders.dependsOn BuildIl2CppTask
}
sourceSets {
main {
jni.srcDirs = ["src/main/Il2CppOutputProject"]
}
}
}
-180
View File
@@ -1,180 +0,0 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Nusantara</title>
<style>
body {
font-family: sans-serif;
margin: 0;
background: #f2f2f2;
}
.container {
max-width: 480px;
margin: auto;
padding: 1rem;
}
h1 {
text-align: center;
font-size: 1.4rem;
}
.grid {
display: grid;
gap: 4px;
margin-top: 1rem;
}
.letter {
background: white;
border-radius: 6px;
padding: 0;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
display: flex;
justify-content: center;
align-items: center;
font-size: 1rem;
font-weight: bold;
text-align: center;
user-select: none;
cursor: pointer;
border: 1px solid #ccc;
aspect-ratio: 1/1;
}
.found {
background-color: #a2f5a2 !important;
}
</style>
</head>
<body>
<div class="container">
<h1 id="game-title">Game Nusantara</h1>
<div id="game-board"></div>
<h3>Kata yang harus ditemukan:</h3>
<ul id="target-words" style="padding-left: 1rem;"></ul>
<p id="penjelasan" style="margin-top: 1rem; font-size: 0.9rem; color: #444;"></p>
</div>
<script>
// Template Find The Word Game (drag to select)
const words = ['TENANG', 'SABAR', 'SYUKUR', 'CINTA', 'GEMBIRA', 'BANGGA'];
const board = document.getElementById('game-board');
const size = 12; // 12x12 grid
let grid = Array(size * size).fill('');
function randomLetter() {
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return alphabet[Math.floor(Math.random() * alphabet.length)];
}
function placeWord(word) {
const dir = Math.random() < 0.5 ? 'H' : 'V';
let x, y, success = false;
while (!success) {
x = Math.floor(Math.random() * (dir === 'H' ? size - word.length : size));
y = Math.floor(Math.random() * (dir === 'V' ? size - word.length : size));
let fits = true;
for (let i = 0; i < word.length; i++) {
let idx = dir === 'H' ? y * size + (x + i) : (y + i) * size + x;
if (grid[idx] && grid[idx] !== word[i]) {
fits = false;
break;
}
}
if (fits) {
for (let i = 0; i < word.length; i++) {
let idx = dir === 'H' ? y * size + (x + i) : (y + i) * size + x;
grid[idx] = word[i];
}
success = true;
}
}
}
words.forEach(w => placeWord(w));
grid = grid.map(cell => cell || randomLetter());
function renderGrid() {
board.className = 'grid';
board.style.gridTemplateColumns = `repeat(${size}, 1fr)`;
board.innerHTML = '';
grid.forEach((char, i) => {
const div = document.createElement('div');
div.textContent = char;
div.className = 'letter';
div.dataset.index = i;
div.style.aspectRatio = '1/1';
div.style.border = '1px solid #ccc';
div.style.display = 'flex';
div.style.alignItems = 'center';
div.style.justifyContent = 'center';
div.style.fontSize = '1.2rem';
div.style.fontWeight = 'bold';
div.style.userSelect = 'none';
div.style.cursor = 'pointer';
board.appendChild(div);
});
}
renderGrid();
// Daftar kata yang harus ditemukan
// (Daftar kata tidak lagi ditampilkan sebagai list)
let currentSelection = [];
let currentWord = '';
let wordsFound = new Set();
let isMouseDown = false;
board.addEventListener('mousedown', (e) => {
if (!e.target.classList.contains('letter')) return;
isMouseDown = true;
selectCell(e.target);
});
board.addEventListener('mouseover', (e) => {
if (!isMouseDown || !e.target.classList.contains('letter')) return;
selectCell(e.target);
});
document.addEventListener('mouseup', () => {
if (words.includes(currentWord)) {
currentSelection.forEach(c => {
c.style.backgroundColor = '#a2f5a2';
c.classList.add('found');
});
const penjelasanBox = document.getElementById('penjelasan');
const regex = new RegExp(currentWord, 'gi');
penjelasanBox.innerHTML = penjelasanBox.innerHTML.replace(regex, `<span style="color:green; font-weight:bold">${currentWord}</span>`);
wordsFound.add(currentWord);
if (wordsFound.size === words.length) {
alert('Selamat! Kamu telah menemukan semua kata positif. Ingat, berpikir positif setiap hari bisa membuat hidupmu lebih ceria dan penuh semangat 🌈');
}
} else {
currentSelection.forEach(c => c.style.backgroundColor = '');
}
currentSelection = [];
currentWord = '';
isMouseDown = false;
});
function selectCell(cell) {
if (cell.classList.contains('found') || currentSelection.includes(cell)) return;
cell.style.backgroundColor = '#ffeaa7';
currentSelection.push(cell);
currentWord += cell.textContent;
}
// Penjelasan pentingnya emosi positif
const penjelasan = `Di dalam hidup, kita bisa merasa banyak hal. Tapi tahukah kamu? Emosi positif seperti <strong>tenang</strong>, <strong>sabar</strong>, <strong>syukur</strong>, <strong>cinta</strong>, <strong>gembira</strong>, dan <strong>bangga</strong> adalah kunci untuk hidup yang sehat dan bahagia. Yuk, temukan kata-kata positif itu di puzzle, lalu pikirkan kapan terakhir kali kamu merasakannya!`;
document.getElementById('penjelasan').innerHTML = penjelasan;
function includeScript(file) {
const script = document.createElement('script');
script.src = file;
document.body.appendChild(script);
}
</script>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

-16
View File
@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script>
window.onload = function() {
document.body.innerHTML += '<p style="color:green;">✅ JS is working!</p>';
};
window.onload = showAlert;
</script>
</head>
<body>
<h1>Hello WebView</h1>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

-279
View File
@@ -1,279 +0,0 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Furikake: Taburan Lezat untuk Nasi!</title>
<style>
/* Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 0;
margin: 0;
font-size: 1rem;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
header {
margin-bottom: 30px;
border-bottom: 1px solid #eee;
padding-bottom: 20px;
}
main {
margin-bottom: 40px;
}
footer {
text-align: center;
padding: 20px 0;
border-top: 1px solid #eee;
font-size: 0.9rem;
color: #666;
}
h1 {
font-size: 2.2rem;
line-height: 1.2;
margin-bottom: 10px;
color: #222;
}
.subtitle {
font-size: 1.2rem;
color: #666;
font-weight: normal;
margin-bottom: 20px;
}
h2 {
font-size: 1.6rem;
margin: 30px 0 15px 0;
color: #333;
}
p {
margin-bottom: 20px;
font-size: 1.1rem;
line-height: 1.7;
}
ul {
margin-bottom: 20px;
padding-left: 20px;
}
li {
margin-bottom: 8px;
font-size: 1.1rem;
}
figure {
margin: 30px 0;
text-align: center;
}
img {
max-width: 100%;
height: auto;
border-radius: 4px;
}
.div-grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 15px;
margin: 20px 0;
}
.div-item {
text-align: center;
flex: 1 0 calc(25% - 15px); /* 4 items per row by default */
min-width: calc(25% - 15px);
max-width: calc(25% - 15px);
}
.div-item img {
width: 100%;
height: 120px;
object-fit: cover;
border-radius: 8px;
}
.div-item p {
margin-top: 8px;
font-size: 0.9em;
}
.full-width-image {
width: 100%;
height: auto;
display: block;
margin: 0;
padding: 0;
}
figcaption {
font-size: 0.9rem;
color: #666;
margin-top: 10px;
}
/* Responsive Adjustments */
/* Tablet Size (768px and below) - 2 items per row */
@media (max-width: 768px) {
.div-item {
flex: 1 0 calc(50% - 15px);
min-width: calc(50% - 15px);
max-width: calc(50% - 15px);
}
}
/* Mobile Size (480px and below) - 1 item per row */
@media (max-width: 480px) {
h1 {
font-size: 1.8rem;
}
.japanese-title {
font-size: 2rem;
}
.subtitle {
font-size: 1.1rem;
}
h2 {
font-size: 1.4rem;
}
p, li {
font-size: 1rem;
}
.container {
padding: 15px;
}
.div-item {
flex: 1 0 100%;
min-width: 100%;
max-width: 100%;
}
}
/* Small Mobile (360px and below) - Adjust font sizes further */
@media (max-width: 360px) {
h1 {
font-size: 1.6rem;
}
h2 {
font-size: 1.3rem;
}
.subtitle {
font-size: 1rem;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Furikake: Taburan Lezat untuk Nasi!</h1>
<p class="subtitle">Tahukah kamu bahwa di Jepang ada bumbu tabur yang bisa membuat nasi menjadi lebih enak?</p>
</header>
<div class="japanese-title">ふりかけ</div>
<main>
<section>
<p>Kata "furikake" berasal dari bahasa Jepang, yaitu "furi" yang berarti menaburkan dan "kake" yang berarti menuangkan. Jadi, furikake adalah bumbu yang ditaburkan di atas nasi supaya lebih lezat!</p>
</section>
<section>
<h2>Asal Usul Furikake</h2>
<p>Furikake pertama kali dibuat di Jepang pada tahun 1913 oleh seorang apoteker bernama Suekichi Yoshimaru. Awalnya, ia ingin membantu orang-orang yang kekurangan kalsium. Maka, ia membuat bubuk dari tulang ikan kering, biji wijen, dan rumput laut. Campuran ini kemudian diberi nama "Gohan no Tomo" yang artinya "Teman Nasi" karena memang cocok untuk dimakan bersama nasi.</p>
</section>
<section>
<h2>Perkembangan Furikake</h2>
<p>Seiring berjalannya waktu, furikake menjadi semakin populer dan dibuat dengan berbagai rasa. Dulu, furikake hanya bisa dibeli oleh orang kaya, tetapi setelah Perang Dunia II, furikake mulai dijual dengan harga terjangkau sehingga semua orang bisa menikmatinya. Akhirnya, pada tahun 1959, furikake semakin terkenal dan banyak orang mulai membuat berbagai variasi rasa yang lebih menarik.</p>
</section>
<section>
<h2>Apa Saja Isi Furikake?</h2>
<p>Furikake biasanya terbuat dari campuran beberapa bahan seperti:</p>
<div class="div-grid">
<div class="div-item">
<img src="nori.jpeg" alt="Nori">
<p>Nori (Rumput Laut)</p>
</div>
<div class="div-item">
<img src="wijen.jpeg" alt="Biji Wijen">
<p>Biji Wijen</p>
</div>
<div class="div-item">
<img src="ikankering.jpg" alt="Katsuobushi">
<p>Katsuobushi (Ikan Kering)</p>
</div>
<div class="div-item">
<img src="gulagaram.jpg" alt="Garam dan Gula">
<p>Garam & Gula</p>
</div>
</div>
<ul>
<li>Rumput laut kering (nori) yang memberikan rasa laut yang khas.</li>
<li>Biji wijen yang menambah rasa gurih dan tekstur renyah.</li>
<li>Katsuobushi (ikan kering) yang menambah rasa gurih dan protein.</li>
<li>Gula dan garam untuk memberikan keseimbangan rasa.</li>
</ul>
</section>
<section>
<h2>Beragam Rasa Furikake</h2>
<p>Sekarang, furikake punya banyak rasa yang bisa dipilih sesuai selera! Beberapa contoh rasa furikake adalah:</p>
<ul>
<li>Wasabi Furikake, untuk yang suka rasa pedas khas wasabi.</li>
<li>Salmon Furikake, dengan aroma salmon yang lezat.</li>
<li>Furikake Vegan, yang dibuat tanpa bahan dari hewan, cocok untuk vegetarian.</li>
</ul>
<figure>
<img src="furikake.jpg" alt="Contoh produk furikake" class="full-width-image">
<figcaption>Berbagai varian produk furikake yang tersedia di pasaran</figcaption>
</figure>
</section>
<section>
<h2>Cara Menikmati Furikake</h2>
<p>Furikake sangat mudah digunakan! Cukup taburkan di atas nasi hangat, dan nasi pun menjadi lebih lezat. Bisa juga ditambahkan ke dalam mie, sup, atau onigiri (nasi kepal) untuk menambah rasa.</p>
<p>Nah, sekarang kamu tahu tentang furikake! Kalau suatu saat berkesempatan mencobanya, jangan lupa untuk menikmati kelezatannya. Siapa tahu, kamu jadi semakin suka makan nasi!</p>
</section>
</main>
<footer>
<p>Artikel tentang Furikake - Taburan Lezat untuk Nasi</p>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

-243
View File
@@ -1,243 +0,0 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Makan Sehat dengan Gizi Seimbang!</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 0;
margin: 0;
font-size: 1rem;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
header {
margin-bottom: 30px;
border-bottom: 1px solid #eee;
padding-bottom: 20px;
}
main {
margin-bottom: 40px;
}
footer {
text-align: center;
padding: 20px 0;
border-top: 1px solid #eee;
font-size: 0.9rem;
color: #666;
}
h1 {
font-size: 2.2rem;
line-height: 1.2;
margin-bottom: 10px;
color: #222;
}
.subtitle {
font-size: 1.2rem;
color: #666;
font-weight: normal;
margin-bottom: 20px;
}
h2 {
font-size: 1.6rem;
margin: 30px 0 15px 0;
color: #333;
}
p {
margin-bottom: 20px;
font-size: 1.1rem;
line-height: 1.7;
}
ul {
margin-bottom: 20px;
padding-left: 20px;
}
li {
margin-bottom: 8px;
font-size: 1.1rem;
}
figure {
margin: 30px 0;
text-align: center;
}
img {
max-width: 100%;
height: auto;
border-radius: 4px;
}
.div-grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 5px;
margin-top: 5px;
}
.div-item {
text-align: center;
max-width: 100px;
flex: 1 1 200px;
}
.div-item img {
width: 100%;
height: auto;
border-radius: 10px;
}
.full-width-image {
width: 100%;
height: auto;
display: block;
margin: 0;
padding: 0;
}
figcaption {
font-size: 0.9rem;
text-align: center;
color: #666;
margin-top: 10px;
}
@media (max-width: 600px) {
h1 {
font-size: 1.8rem;
}
.subtitle {
font-size: 1.1rem;
}
h2 {
font-size: 1.4rem;
}
p, li {
font-size: 1rem;
}
.container {
padding: 15px;
}
.div-grid {
flex-direction: column;
align-items: center;
}
.div-item {
max-width: 80%;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Makan Sehat dengan Gizi Seimbang!</h1>
<p class="subtitle">Tahukah kamu bahwa makan dengan gizi seimbang itu penting untuk tubuh kita?</p>
</header>
<main>
<section>
<p>Gizi seimbang berarti kita harus makan berbagai jenis makanan dengan jumlah yang pas supaya tubuh tetap sehat dan kuat!</p>
</section>
<section>
<h2>Apa Itu Gizi Seimbang?</h2>
<p>Gizi seimbang adalah cara makan yang mengandung semua zat gizi yang dibutuhkan tubuh. Zat gizi itu terdiri dari:</p>
<div class="div-grid">
<div class="div-item">
<img src="karbohidrat.png" alt="Karbohidrat" />
<p><strong>Karbohidrat</strong><br>Sumber energi seperti nasi, roti, dan kentang.</p>
</div>
<div class="div-item">
<img src="protein.png" alt="Protein" />
<p><strong>Protein</strong><br>Untuk membangun otot, misalnya ikan, telur, dan tahu.</p>
</div>
<div class="div-item">
<img src="lemak.png" alt="Lemak" />
<p><strong>Lemak</strong><br>Memberikan tenaga, seperti dari kacang-kacangan dan minyak sehat.</p>
</div>
<div class="div-item">
<img src="vitaminmineral.png" alt="Vitamin dan Mineral" />
<p><strong>Vitamin dan mineral</strong><br>Dari sayur dan buah yang membantu tubuh bekerja dengan baik.</p>
</div>
<div class="div-item">
<img src="seratair.png" alt="Serat dan Air" />
<p><strong>Serat dan air</strong><br>Membantu pencernaan dan menjaga tubuh tetap segar!</p>
</div>
</div>
</section>
<section>
<h2>Porsi Makan yang Seimbang</h2>
<p>Supaya makan kita sehat, ada aturan "Isi Piringku" yang bisa kita ikuti:</p>
<ul>
<li>🍽️ Separuh piring: Sayur dan buah</li>
<li>🍽️ Seperempat piring: Karbohidrat (seperti nasi atau roti)</li>
<li>🍽️ Seperempat piring: Protein (seperti ayam atau tempe)</li>
<li>🍽️ Sedikit lemak sehat</li>
</ul>
<img src="isipiringku.png" alt="Piring Gizi Seimbang" class="full-width-image">
<figcaption>Isi Piringku</figcaption>
<p>Selain itu, kita tidak boleh makan terlalu banyak atau terlalu sedikit, karena bisa membuat tubuh tidak sehat. Makan berlebihan bisa menyebabkan obesitas, sedangkan makan terlalu sedikit bisa membuat tubuh lemas dan kurang gizi.</p>
</section>
<section>
<h2>Menjaga Kebersihan Makanan</h2>
<p>Selain memilih makanan sehat, kita juga harus menjaga kebersihan makanan agar tidak sakit perut! Caranya:</p>
<ul>
<li>Cuci tangan sebelum makan dan mengolah makanan.</li>
<li>Simpan makanan dengan baik agar tidak terkena kuman.</li>
<li>Masak makanan dengan suhu yang cukup supaya aman dimakan.</li>
</ul>
</section>
<section>
<h2>Aktivitas Fisik Itu Penting!</h2>
<p>Selain makan sehat, kita juga harus rajin bergerak! Olahraga atau bermain di luar rumah bisa membantu tubuh tetap bugar, menjaga berat badan, dan membuat kita lebih bersemangat.</p>
</section>
<section>
<h2>Yuk, Mulai Gizi Seimbang!</h2>
<p>Makan dengan gizi seimbang akan membuat tubuh kita lebih sehat, kuat, dan penuh energi. Yuk, biasakan makan sehat mulai sekarang supaya kita tumbuh dengan baik dan terhindar dari penyakit!</p>
</section>
</main>
<footer>
<p>Artikel tentang Makan Sehat dengan Gizi Seimbang</p>
</footer>
</div>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

-176
View File
@@ -1,176 +0,0 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Nusantara</title>
<link rel="icon" href="data:,">
<style>
body {
font-family: sans-serif;
margin: 0;
background: #f2f2f2;
}
.container {
max-width: 480px;
margin: auto;
padding: 1rem;
}
h1 {
text-align: center;
font-size: 1.4rem;
}
.grid, .drag-area, .drop-area {
display: grid;
gap: 10px;
margin-top: 1rem;
}
.grid {
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}
.card, .letter, .drop-zone, .drag-item {
background: white;
border-radius: 6px;
padding: 10px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
display: flex;
justify-content: center;
align-items: center;
font-size: 0.8rem;
text-align: center;
user-select: none;
}
.hidden { background: #ccc; color: transparent; }
.matched { background: #d4edda; }
.drop-zone { height: 80px; background: #eee; border: 2px dashed #bbb; }
.drag-item[draggable="true"] { cursor: grab; }
</style>
</head>
<body>
<div class="container">
<h1 id="game-title">Game Nusantara</h1>
<div id="game-board"></div>
</div>
<script>
const items = [
'pempek.png', 'sumsel.png',
'sopkonro.png', 'sulsel.png',
'rendang.png', 'sumbar.png',
'tinutuan.png', 'sulut.png',
'ayambetutu.png', 'bali.png',
'bikaambon.png', 'sumut.png',
'gudeg.png', 'yogyakarta.png',
'sotobanjar.png', 'kalsel.png',
'ayamtaliwang.png', 'ntb.png'
];
const board = document.getElementById('game-board');
board.className = 'grid';
board.style.gridTemplateColumns = 'repeat(3, 1fr)';
let selectedItems = shuffle([...items]);
let shuffled = shuffle(selectedItems.slice(0, 18));
let selected = [], matched = [];
function shuffle(array) {
return array.sort(() => Math.random() - 0.5);
}
function render() {
board.innerHTML = '';
shuffled.forEach((img, i) => {
const card = document.createElement('div');
card.className = 'card hidden';
card.style.backgroundImage = 'url("../freekake.png")';
card.style.backgroundSize = 'contain';
card.style.backgroundRepeat = 'no-repeat';
card.style.backgroundPosition = 'center';
card.dataset.index = i;
card.style.aspectRatio = '1/1';
card.style.borderRadius = '12px';
card.style.overflow = 'hidden';
card.style.backgroundColor = '#fff';
card.style.display = 'flex';
card.style.flexDirection = 'column';
card.style.alignItems = 'center';
card.style.justifyContent = 'center';
card.style.padding = '8px';
card.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
board.appendChild(card);
});
}
function revealCard(i) {
const el = board.children[i];
el.classList.remove('hidden');
el.style.backgroundImage = 'none';
el.innerHTML = `<img src="${shuffled[i]}" alt="" style="width: 100%; height: auto; object-fit: contain;">`;
}
function hideCard(i) {
const el = board.children[i];
el.classList.add('hidden');
el.style.backgroundImage = 'url("../freekake.png")';
el.style.backgroundSize = 'contain';
el.style.backgroundRepeat = 'no-repeat';
el.style.backgroundPosition = 'center';
el.innerHTML = '';
}
function checkMatch() {
const [a, b] = selected;
const pairs = {
'pempek.png': 'sumsel.png', 'sumsel.png': 'pempek.png',
'sopkonro.png': 'sulsel.png', 'sulsel.png': 'sopkonro.png',
'rendang.png': 'sumbar.png', 'sumbar.png': 'rendang.png',
'tinutuan.png': 'sulut.png', 'sulut.png': 'tinutuan.png',
'ayambetutu.png': 'bali.png', 'bali.png': 'ayambetutu.png',
'bikaambon.png': 'sumut.png', 'sumut.png': 'bikaambon.png',
'gudeg.png': 'yogyakarta.png', 'yogyakarta.png': 'gudeg.png',
'sotobanjar.png': 'kalsel.png', 'kalsel.png': 'sotobanjar.png',
'ayamtaliwang.png': 'ntb.png', 'ntb.png': 'ayamtaliwang.png'
};
if (pairs[shuffled[a]] === shuffled[b]) {
matched.push(a, b);
board.children[a].classList.add('matched');
board.children[a].style.backgroundColor = '#d4edda';
board.children[b].classList.add('matched');
board.children[b].style.backgroundColor = '#d4edda';
} else {
setTimeout(() => {
hideCard(a);
hideCard(b);
}, 800);
}
selected = [];
}
render();
board.addEventListener('click', (e) => {
const index = e.target.closest('.card')?.dataset.index;
if (!index || selected.includes(+index) || matched.includes(+index)) return;
revealCard(index);
selected.push(+index);
if (selected.length === 2) checkMatch();
});
window.render = render;
if (window.flutter_inappwebview) {
window.flutter_inappwebview.callHandler('pageReady', {
boardExists: !!document.getElementById("game-board"),
hasRender: typeof render === "function"
});
}
// Optional helper
function includeScript(file) {
const script = document.createElement('script');
script.src = file;
document.body.appendChild(script);
}
</script>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 KiB

+5 -2
View File
@@ -1,5 +1,9 @@
import 'package:freekake/components/navbar_shape_3.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/navbar_container.dart';
import 'package:freekake/components/navbar_shape_1.dart';
import 'package:freekake/components/navbar_shape_2.dart';
import 'package:freekake/components/navbar_shape_3.dart';
import 'package:freekake/components/custom_shape.dart';
class BottomNavbar extends StatefulWidget { class BottomNavbar extends StatefulWidget {
const BottomNavbar({super.key}); const BottomNavbar({super.key});
@@ -9,7 +13,6 @@ class BottomNavbar extends StatefulWidget {
} }
class _BottomNavbarState extends State<BottomNavbar> { class _BottomNavbarState extends State<BottomNavbar> {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size screenSize = MediaQuery.of(context).size; final Size screenSize = MediaQuery.of(context).size;
return CustomPaint( return CustomPaint(
+13 -89
View File
@@ -1,22 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class CardList extends StatelessWidget { class CardList extends StatelessWidget {
final String title; const CardList({super.key});
final String body;
final String? gambar;
final String? tipe;
final String? point;
final String? coint;
const CardList({
super.key,
required this.title,
required this.body,
this.gambar,
this.tipe,
this.point,
this.coint,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -33,16 +18,8 @@ class CardList extends StatelessWidget {
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(
10.0, 10.0,
), // Opsional: membuat gambar lebih rounded ), // Opsional: membuat gambar lebih rounded
child: child: Image.asset(
(gambar != null) 'assets/images/cepott.png', // Ganti dengan path gambar Anda
? Image.asset(
gambar!,
width: 65, // Atur ukuran gambar
height: 80,
fit: BoxFit.cover,
)
: Image.asset(
'assets/images/cepott.png',
width: 80, // Atur ukuran gambar width: 80, // Atur ukuran gambar
height: 120, height: 120,
fit: BoxFit.cover, fit: BoxFit.cover,
@@ -54,18 +31,17 @@ class CardList extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
title, "Judul Card",
style: const TextStyle( style: const TextStyle(
fontSize: 14, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
const SizedBox(height: 1, width: 5), const SizedBox(height: 5, width: 10),
Text( Text(
body, "Deskripsi singkat tentang item ini. karena ini sangat panjang maka ini akan dipotong",
style: const TextStyle( style: const TextStyle(
letterSpacing: 0.2, fontSize: 12,
fontSize: 14,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
), ),
maxLines: 2, maxLines: 2,
@@ -73,71 +49,19 @@ class CardList extends StatelessWidget {
), ),
const Spacer(), const Spacer(),
Padding( Padding(
padding: EdgeInsets.all(0.08), padding: const EdgeInsets.all(8.0),
child: Row( child: const Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
children: [ children: [
Chip( Text("50"),
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
point ?? ' 200',
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
backgroundColor: Colors.blue,
avatar: const CircleAvatar(
backgroundColor: Colors.transparent,
child: Icon(
Icons.emoji_events,
size: 16,
color: Colors.amber,
),
),
),
SizedBox(width: 40), SizedBox(width: 40),
Chip( Text("100"),
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
coint ?? " 100",
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
backgroundColor: Colors.blue,
avatar: const CircleAvatar(
backgroundColor: Colors.transparent,
child: Icon(
Icons.monetization_on,
size: 12,
color: Colors.amber,
),
),
),
], ],
), ),
Chip( Text("Quiz"),
labelPadding: EdgeInsets.symmetric(
horizontal: 0,
vertical: 0,
),
label: Text(
tipe ?? "Text",
style: TextStyle(color: Colors.white, fontSize: 14),
),
backgroundColor: Colors.blue,
),
], ],
), ),
), ),
-142
View File
@@ -1,142 +0,0 @@
import 'package:flutter/material.dart';
class CharacterInfo extends StatelessWidget {
final String nama;
final String kelamin;
final String asal;
final String content;
const CharacterInfo({
super.key,
required this.nama,
required this.kelamin,
required this.asal,
required this.content,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
SizedBox(
width: 120,
child: Text(
"Nama Karakter",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(width: 5),
Text(
":",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(width: 5),
Text(
nama,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
Row(
children: [
SizedBox(
width: 120,
child: Text(
"Jenis Kelamin",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(width: 5),
Text(
":",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(width: 5),
Text(
kelamin,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
Row(
children: [
SizedBox(
width: 120,
child: Text(
"Asal Karakter",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(width: 5),
Text(
":",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(width: 5),
Text(
asal,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
SizedBox(height: 20),
Text(
content,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.black,
),
),
],
);
}
}
+2 -2
View File
@@ -17,7 +17,7 @@ class CollectionContainer extends StatelessWidget {
final bool? small; final bool? small;
const CollectionContainer({ const CollectionContainer({
super.key, Key? key,
this.label, this.label,
this.imagesrc, this.imagesrc,
this.imageSvg, this.imageSvg,
@@ -31,7 +31,7 @@ class CollectionContainer extends StatelessWidget {
this.circle, this.circle,
this.colorContiner, this.colorContiner,
this.small, this.small,
}); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
+1 -2
View File
@@ -6,7 +6,6 @@ class CurvedBottomBorderTab extends StatelessWidget {
final VoidCallback tap; final VoidCallback tap;
const CurvedBottomBorderTab({ const CurvedBottomBorderTab({
super.key,
required this.isSelected, required this.isSelected,
required this.label, required this.label,
required this.tap, required this.tap,
@@ -17,7 +16,6 @@ class CurvedBottomBorderTab extends StatelessWidget {
return CustomPaint( return CustomPaint(
painter: isSelected ? CurvedBottomPainter() : null, painter: isSelected ? CurvedBottomPainter() : null,
child: GestureDetector( child: GestureDetector(
onTap: tap,
child: Container( child: Container(
width: 110, width: 110,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
@@ -36,6 +34,7 @@ class CurvedBottomBorderTab extends StatelessWidget {
), ),
), ),
), ),
onTap: tap,
), ),
); );
} }
+10 -10
View File
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:freekake/components/navbar_shape_2.dart'; import 'package:freekake/components/navbar_shape_2.dart';
class CustomShape extends StatelessWidget { class CustomShape extends StatelessWidget {
const CustomShape({super.key}); const CustomShape({super.key});
@@ -23,7 +23,7 @@ class RPSCustomPainter extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
// Layer 1 // Layer 1
Paint paintFill0 = Paint paint_fill_0 =
Paint() Paint()
..color = const Color.fromARGB(255, 189, 18, 18) ..color = const Color.fromARGB(255, 189, 18, 18)
..style = PaintingStyle.fill ..style = PaintingStyle.fill
@@ -67,11 +67,11 @@ class RPSCustomPainter extends CustomPainter {
); );
path_0.close(); path_0.close();
canvas.drawPath(path_0, paintFill0); canvas.drawPath(path_0, paint_fill_0);
// Layer 1 // Layer 1
Paint paintStroke0 = Paint paint_stroke_0 =
Paint() Paint()
..color = const Color.fromARGB(255, 33, 150, 243) ..color = const Color.fromARGB(255, 33, 150, 243)
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
@@ -79,11 +79,11 @@ class RPSCustomPainter extends CustomPainter {
..strokeCap = StrokeCap.butt ..strokeCap = StrokeCap.butt
..strokeJoin = StrokeJoin.miter; ..strokeJoin = StrokeJoin.miter;
canvas.drawPath(path_0, paintStroke0); canvas.drawPath(path_0, paint_stroke_0);
// Layer 1 // Layer 1
Paint paintFill1 = Paint paint_fill_1 =
Paint() Paint()
..color = const Color.fromARGB(255, 28, 163, 52) ..color = const Color.fromARGB(255, 28, 163, 52)
..style = PaintingStyle.fill ..style = PaintingStyle.fill
@@ -116,11 +116,11 @@ class RPSCustomPainter extends CustomPainter {
); );
path_1.close(); path_1.close();
canvas.drawPath(path_1, paintFill1); canvas.drawPath(path_1, paint_fill_1);
// Layer 1 // Layer 1
Paint paintStroke1 = Paint paint_stroke_1 =
Paint() Paint()
..color = const Color.fromARGB(255, 33, 150, 243) ..color = const Color.fromARGB(255, 33, 150, 243)
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
@@ -128,7 +128,7 @@ class RPSCustomPainter extends CustomPainter {
..strokeCap = StrokeCap.butt ..strokeCap = StrokeCap.butt
..strokeJoin = StrokeJoin.miter; ..strokeJoin = StrokeJoin.miter;
canvas.drawPath(path_1, paintStroke1); canvas.drawPath(path_1, paint_stroke_1);
// layer 2 // layer 2
// Paint paint_fill_0 = // Paint paint_fill_0 =
@@ -164,7 +164,7 @@ class RPSCustomPainter extends CustomPainter {
); );
path_0.close(); path_0.close();
canvas.drawPath(path_0, paintFill0); canvas.drawPath(path_0, paint_fill_0);
// Layer 1 // Layer 1
+20 -10
View File
@@ -1,15 +1,16 @@
import 'package:flutter/material.dart';
import 'package:freekake/components/bottom_navbar.dart';
import 'package:freekake/components/menu_button.dart'; import 'package:freekake/components/menu_button.dart';
import 'package:freekake/providers/menu_selection_provider.dart'; import 'package:freekake/components/scan_button.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:freekake/screen/Home_screen.dart';
import 'package:freekake/screen/koleksi_screen.dart'; import 'package:freekake/screen/koleksi_screen.dart';
import 'package:freekake/screen/pustaka_screen.dart'; import 'package:freekake/screen/pustaka_screen.dart';
import 'package:freekake/screen/saya/profile_screen.dart'; import 'package:freekake/screen/saya/profile_screen.dart';
import 'package:flutter/material.dart'; import 'package:freekake/providers/menu_selection_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class MainMenu extends StatefulWidget { class MainMenu extends StatefulWidget {
const MainMenu({super.key}); const MainMenu({super.key});
@override
_MainMenuState createState() => _MainMenuState(); _MainMenuState createState() => _MainMenuState();
} }
@@ -23,6 +24,19 @@ class _MainMenuState extends State<MainMenu> {
ProfileScreen(), ProfileScreen(),
]; ];
// void _onItemTapped(int index) {
// Future.delayed(Duration(milliseconds: 100), () {
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(builder: (context) => _screens[index]),
// );
// });
// setState(() {
// selectedIndex = index;
// });
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size; final Size size = MediaQuery.of(context).size;
@@ -30,13 +44,8 @@ class _MainMenuState extends State<MainMenu> {
Provider.of<MenuSelectionProvider>(context).selectedIndex; Provider.of<MenuSelectionProvider>(context).selectedIndex;
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 5), padding: const EdgeInsets.symmetric(vertical: 10),
child: _btns(context, selectedIndex), child: Row(
);
}
Row _btns(BuildContext context, int selectedIndex) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -66,6 +75,7 @@ class _MainMenuState extends State<MainMenu> {
isSelected: selectedIndex == 3, isSelected: selectedIndex == 3,
), ),
], ],
),
); );
} }
+3 -2
View File
@@ -28,8 +28,8 @@ class MenuButton extends StatelessWidget {
IconButton( IconButton(
icon: SvgPicture.asset( icon: SvgPicture.asset(
icon ?? '', icon ?? '',
width: w ?? 28, width: w ?? 24,
height: h ?? 28, height: h ?? 24,
// allowDrawingOutsideViewBox: true, // allowDrawingOutsideViewBox: true,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
(isSelected ?? false) (isSelected ?? false)
@@ -48,6 +48,7 @@ class MenuButton extends StatelessWidget {
? Color.fromARGB(255, 216, 182, 10) ? Color.fromARGB(255, 216, 182, 10)
: Color.fromARGB(255, 239, 224, 232), : Color.fromARGB(255, 239, 224, 232),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 10,
), ),
), ),
], ],
-7
View File
@@ -1,7 +0,0 @@
import 'package:flutter/material.dart';
class MenuItem {
const MenuItem({required this.text, required this.icon});
final String text;
final IconData icon;
}
+2 -1
View File
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/navbar_shape_2.dart';
class NavbarContainer extends StatelessWidget { class NavbarContainer extends StatelessWidget {
const NavbarContainer({super.key}); const NavbarContainer({super.key});
@@ -22,7 +23,7 @@ class MyShape extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
// TODO: implement paint // TODO: implement paint
Paint paint = Paint paint =
Paint() new Paint()
..color = const Color.fromARGB(255, 166, 12, 66) ..color = const Color.fromARGB(255, 166, 12, 66)
..style = PaintingStyle.fill; ..style = PaintingStyle.fill;
+1 -1
View File
@@ -7,7 +7,7 @@ class BNBCustomPainter2 extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
debugPrint("Drawing navbar..."); debugPrint("Drawing navbar...");
Paint paint = Paint paint =
Paint() new Paint()
..color = const Color.fromARGB(255, 79, 76, 182) ..color = const Color.fromARGB(255, 79, 76, 182)
..style = PaintingStyle.fill; ..style = PaintingStyle.fill;
+2 -2
View File
@@ -7,7 +7,7 @@ class BNBCustomPainter3 extends CustomPainter {
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
debugPrint("Drawing navbar..."); debugPrint("Drawing navbar...");
Paint paint = Paint paint =
Paint() new Paint()
..color = const Color.fromARGB(255, 79, 76, 182) ..color = const Color.fromARGB(255, 79, 76, 182)
..style = PaintingStyle.fill; ..style = PaintingStyle.fill;
@@ -17,7 +17,7 @@ class BNBCustomPainter3 extends CustomPainter {
path.quadraticBezierTo(size.width * 0.40, 0, size.width * 0.40, 20); path.quadraticBezierTo(size.width * 0.40, 0, size.width * 0.40, 20);
path.arcToPoint( path.arcToPoint(
Offset(size.width * 0.60, 20), Offset(size.width * 0.60, 20),
radius: Radius.circular(size.height * 0.5), radius: Radius.circular(20.0),
clockwise: false, clockwise: false,
); );
path.quadraticBezierTo(size.width * 0.60, 0, size.width * 0.63, 0); path.quadraticBezierTo(size.width * 0.60, 0, size.width * 0.63, 0);
-39
View File
@@ -1,39 +0,0 @@
import 'package:flutter/material.dart';
import 'package:freekake/providers/point_provider.dart';
import 'package:provider/provider.dart';
class PointsHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final points = context.watch<PointsProvider>().points;
return Container(
padding: EdgeInsets.all(12),
color: const Color.fromARGB(99, 255, 255, 255),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text(
"Activity", //${points.xp}/${points.xpToNextLevel()}",
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
Text(
"",
// "🔥 Level: ${points.level}",
// style: TextStyle(color: Colors.orangeAccent),
),
Text(
"🏆",
// "💎 GP: ${points.gp}",
style: TextStyle(color: Colors.lightBlue),
),
Text(
"🟡",
// "🎯" SP: ${points.sp}",
style: TextStyle(color: Colors.greenAccent),
),
],
),
);
}
}
+7 -23
View File
@@ -1,47 +1,31 @@
import 'package:freekake/screen/camera_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
// import 'package:freekake/screen/camera_screen.dart';
class ScanButton extends StatelessWidget { class ScanButton extends StatelessWidget {
const ScanButton({super.key}); const ScanButton({super.key});
static const Color transparent = Color(0x0fffffff); static const Color transparent = Color(0xFFFFFFF);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
// Skala berdasarkan lebar layar
final buttonSize = screenWidth * 0.20; // Adjust as needed
final iconSize = buttonSize * 0.7;
final padding = buttonSize * 0.15;
return Container( return Container(
width: buttonSize, width: 76,
height: buttonSize, height: 76,
// width: 76,
// height: 76,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: const Color.fromARGB(223, 67, 63, 179), color: const Color.fromARGB(223, 67, 63, 179),
), ),
padding: EdgeInsets.all(padding), padding: EdgeInsets.all(10),
child: IconButton( child: IconButton(
icon: SvgPicture.asset( icon: SvgPicture.asset(
'assets/icons/Scan.svg', 'assets/icons/Scan.svg',
width: iconSize, width: 60,
height: iconSize, height: 60,
colorFilter: ColorFilter.mode( colorFilter: ColorFilter.mode(
Color.fromARGB(255, 217, 219, 227), Color.fromARGB(255, 217, 219, 227),
BlendMode.srcIn, BlendMode.srcIn,
), ),
), ),
onPressed: () { onPressed: () {},
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CameraScreen()),
);
},
), ),
); );
} }
-104
View File
@@ -1,104 +0,0 @@
import 'package:flutter/material.dart';
class SkinInfo extends StatelessWidget {
final String nama;
final String asal;
final String content;
const SkinInfo({
super.key,
required this.nama,
required this.asal,
required this.content,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
SizedBox(
width: 120,
child: Text(
"Nama Pakaian",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(width: 5),
Text(
":",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(width: 5),
Text(
nama,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
Row(
children: [
SizedBox(
width: 120,
child: Text(
"Daerah Asal",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
SizedBox(width: 5),
Text(
":",
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(width: 5),
Text(
asal,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],
),
SizedBox(height: 20),
Text(
content,
style: const TextStyle(
letterSpacing: 0.2,
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.black,
),
),
],
);
}
}
-1
View File
@@ -8,7 +8,6 @@ class TopbarContainer extends StatefulWidget {
} }
class _TopbarContainerState extends State<TopbarContainer> { class _TopbarContainerState extends State<TopbarContainer> {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size; final Size size = MediaQuery.of(context).size;
return Container( return Container(
+14
View File
@@ -0,0 +1,14 @@
import 'dart:io';
import 'package:image_picker/image_picker.dart';
class ImagePickerHelper {
Future<dynamic> pickImage() async {
final ImagePicker picker = ImagePicker();
final XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
File imageFile = File(pickedFile.path);
return imageFile;
}
}
}
+5
View File
@@ -0,0 +1,5 @@
class ImagePickerHelper {
Future<void> pickImage() async {
throw UnsupportedError('pickImage is not supported on this platform');
}
}
+35
View File
@@ -0,0 +1,35 @@
// import 'package:image_picker_web/image_picker_web.dart';
// import 'dart:typed_data';
// class ImagePickerHelper {
// Future<dynamic> pickImage() async {
// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
// if (bytesFromPicker != null) {
// return bytesFromPicker;
// }
// }
// }
import 'dart:typed_data';
import 'dart:html' as html;
class ImagePickerHelper {
Future<void> pickImage() async {
html.FileUploadInputElement uploadInput = html.FileUploadInputElement();
uploadInput.accept = 'image/*';
uploadInput.click();
uploadInput.onChange.listen((event) async {
final file = uploadInput.files!.first;
final reader = html.FileReader();
reader.readAsArrayBuffer(file);
reader.onLoadEnd.listen((event) {
Uint8List imageBytes = reader.result as Uint8List;
if (imageBytes != null) {
return imageBytes;
}
});
});
}
}
+3
View File
@@ -0,0 +1,3 @@
export 'image_picker_stub.dart'
if (dart.library.html) 'image_picker_web.dart'
if (dart.library.io) 'image_picker_mobile.dart';
+3 -10
View File
@@ -1,21 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:freekake/components/navbar_container.dart';
import 'package:freekake/providers/character_provider.dart'; import 'package:freekake/providers/character_provider.dart';
import 'package:freekake/providers/menu_selection_provider.dart';
import 'package:freekake/providers/point_provider.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:freekake/screen/Home_screen.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:freekake/providers/menu_selection_provider.dart';
void main() async { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
await SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
runApp(const MyApp()); runApp(const MyApp());
} }
@@ -28,7 +22,6 @@ class MyApp extends StatelessWidget {
providers: [ providers: [
ChangeNotifierProvider(create: (context) => CharacterProvider()), ChangeNotifierProvider(create: (context) => CharacterProvider()),
ChangeNotifierProvider(create: (context) => MenuSelectionProvider()), ChangeNotifierProvider(create: (context) => MenuSelectionProvider()),
ChangeNotifierProvider(create: (_) => PointsProvider()),
], ],
child: MaterialApp( child: MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
-31
View File
@@ -1,31 +0,0 @@
class Users {
int id;
// String nama;
// String tgl;
// String? alamat;
Users({
required this.id,
// required this.nama, this.alamat, required this.tgl
});
Map<String, dynamic> toMap() {
return {
"id": id,
// "nama": nama, "alamat": this.alamat, "tgl": this.tgl
};
}
factory Users.fromJson(Map<String, dynamic> map) {
return Users(
id: map['id'],
// nama: map['nama'],
// alamat: map['alamat'],
// tgl: map['tanggal'],
);
}
String toString() {
return 'Users{id:$id,}';
}
}
-23
View File
@@ -1,23 +0,0 @@
import 'package:flutter/material.dart';
import 'package:freekake/util/player_point.dart';
class PointsProvider with ChangeNotifier {
PlayerPoints _points = PlayerPoints(xp: 0, gp: 0, sp: 0, level: 1);
PlayerPoints get points => _points;
void gainXP(int value) {
_points.addXP(value);
notifyListeners();
}
void gainGP(int value) {
_points.addGP(value);
notifyListeners();
}
void gainSP(int value) {
_points.addSP(value);
notifyListeners();
}
}
+184 -88
View File
@@ -3,64 +3,98 @@ import 'package:flutter/material.dart';
import 'package:freekake/components/bottom_navbar.dart'; import 'package:freekake/components/bottom_navbar.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:freekake/components/buildcard_info.dart';
import 'package:freekake/components/main_menu.dart'; import 'package:freekake/components/main_menu.dart';
import 'package:freekake/components/menu_item.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:freekake/components/scan_button.dart';
import 'package:freekake/components/topbar_container.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
const HomeScreen({super.key}); HomeScreen({super.key});
@override @override
State<HomeScreen> createState() => _HomeScreenState(); State<HomeScreen> createState() => _HomeScreenState();
} }
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
final String username = "luffy01"; final String username = "User01";
double _sliderValue = 0.0;
static const Color transparent = Color(0xFFFFFFFF);
// Image image // Image image
late UnityWidgetController _unityWidgetController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size; final Size size = MediaQuery.of(context).size;
final isLandscape = size.width > size.height;
final screenWidth = MediaQuery.of(context).size.width;
final buttonScanSize = screenWidth * 0.20;
final double bottomPadding = (9000 / screenWidth).clamp(0, 0.2);
double bottomOffset = -(screenWidth * 0.25) + 180;
return Scaffold( return Scaffold(
body: homeBody( // appBar: AppBar(
context, // elevation: 0,
isLandscape, // backgroundColor: Color(0x00000000),
bottomOffset, // title: Row(
bottomPadding, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
screenWidth, // children: [
buttonScanSize, // Row(
), // children: [
); // Text(
} // username,
// style: const TextStyle(
Stack homeBody( // fontSize: 18,
BuildContext context, // fontWeight: FontWeight.bold,
bool isLandscape, // ),
double bottomOffset, // ),
double bottomPadding, // SizedBox(width: 10),
double screenWidth, // IconButton(
double buttonScanSize, // icon: Icon(Icons.emoji_events, color: Color(0xFFE32087)),
) { // onPressed: () {},
return Stack( // ),
// Text(
// "5000",
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
// ),
// ],
// ),
// Row(
// children: [
// IconButton(
// icon: Icon(Icons.monetization_on, color: Color(0xFFE32087)),
// onPressed: () {},
// ),
// Text(
// "1.300",
// style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
// ),
// // IconButton(
// // icon: Image.asset("images/icon.png", width: 24),
// // onPressed: () {},
// // ),
// ],
// ),
// ],
// ),
// ),
body: Stack(
children: <Widget>[ children: <Widget>[
Positioned.fill( Positioned.fill(
child: RepaintBoundary( child: UnityWidget(
child: Container( onUnityCreated: onUnityCreated,
decoration: const BoxDecoration( //isARScene: true,
image: DecorationImage( onUnityMessage: onUnityMessage,
image: AssetImage("assets/images/background.jpeg"), //onUnitySceneLoaded: onUnitySceneLoaded,
fit: BoxFit.cover, fullscreen: false,
), ),
// child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage("assets/images/background.jpeg"),
// fit: BoxFit.cover,
// ),
// ),
// ),
), ),
), // Positioned(
), // top: 0,
), // left: 0,
// right: 0,
// child: SizedBox(height: 120, child: TopbarContainer()),
// ),
Positioned( Positioned(
right: 0, right: 0,
top: 100, top: 100,
@@ -77,12 +111,12 @@ class _HomeScreenState extends State<HomeScreen> {
child: DropdownButtonHideUnderline( child: DropdownButtonHideUnderline(
child: DropdownButton2( child: DropdownButton2(
customButton: Container( customButton: Container(
height: 100, height: 50,
width: 100, width: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
image: const DecorationImage( image: const DecorationImage(
image: AssetImage('assets/images/cepot-u.png'), image: AssetImage('assets/images/luffy-u.png'),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@@ -90,11 +124,23 @@ class _HomeScreenState extends State<HomeScreen> {
openWithLongPress: false, openWithLongPress: false,
items: [ items: [
..._MenuItems.firstItems.map( ..._MenuItems.firstItems.map(
(item) => DropdownMenuItem<MenuItem>( (item) => DropdownMenuItem<_MenuItem>(
value: item, value: item,
child: _MenuItems.buildItem(item), child: _MenuItems.buildItem(item),
), ),
), ),
// const DropdownMenuItem<Divider>(
// enabled: false,
// // height: 8,
// child: Divider(),
// ),
// ..._MenuItems.secondItems.map(
// (item) => DropdownMenuItem<_MenuItem>(
// value: item,
// // height: 48,
// child: _MenuItems.buildItem(item),
// ),
// ),
], ],
onChanged: (value) { onChanged: (value) {
if (value != null) { if (value != null) {
@@ -154,25 +200,25 @@ class _HomeScreenState extends State<HomeScreen> {
], ],
), ),
), ),
Positioned( // Positioned(
bottom: 150, // bottom: 150,
left: 0, // left: 0,
right: 0, // right: 0,
child: Column( // child: Column(
children: [ // children: [
Container( // Container(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), // padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: Color.fromARGB(255, 247, 224, 236), // color: Color.fromARGB(255, 247, 224, 236),
borderRadius: BorderRadius.circular(10), // borderRadius: BorderRadius.circular(10),
boxShadow: [ // boxShadow: [
BoxShadow( // BoxShadow(
color: Color.fromARGB(255, 214, 213, 121), // color: Color.fromARGB(255, 214, 213, 121),
blurRadius: 5, // blurRadius: 5,
spreadRadius: 2, // spreadRadius: 2,
), // ),
], // ],
), // ),
// child: Text( // child: Text(
// "Halo....Jotaslim", // "Halo....Jotaslim",
// style: TextStyle( // style: TextStyle(
@@ -181,12 +227,13 @@ class _HomeScreenState extends State<HomeScreen> {
// color: Color(0xFF000000), // color: Color(0xFF000000),
// ), // ),
// ), // ),
), // ),
SizedBox(height: 10), // SizedBox(height: 10),
setHomeImage("assets/images/cepott.png", 300), // setHomeImage("images/luffy.png", 300),
], // // Image.asset("images/luffy.png", width: 300),
), // ],
), // ),
// ),
// BG MEnu // BG MEnu
Stack( Stack(
children: [ children: [
@@ -199,45 +246,94 @@ class _HomeScreenState extends State<HomeScreen> {
], ],
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: bottom: 8,
isLandscape left: MediaQuery.of(context).size.width / 2 - 38,
? bottomOffset.clamp(-200.0, -50.0)
: bottomPadding * 55,
left: (screenWidth - buttonScanSize) / 2,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -30), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),
), ),
), ),
], ],
),
); );
} }
void onUnityCreated(controller) {
_unityWidgetController = controller;
}
void onUnityMessage(message) {
print('Received message from unity: ${message.toString()}');
}
// Widget _menuButton(String label, Widget icon) {
// return Expanded(
// child: Column(
// children: [
// IconButton(
// // icon: Icon(icon, color: Color.fromARGB(255, 179, 161, 170)),
// icon: icon,
// onPressed: () {},
// ),
// Text(
// label,
// style: TextStyle(
// color: Color.fromARGB(255, 239, 224, 232),
// fontWeight: FontWeight.bold,
// ),
// ),
// ],
// ),
// );
// }
// Widget _scanButton() {
// return Expanded(
// child: Container(
// decoration: BoxDecoration(shape: BoxShape.circle, color: transparent),
// padding: EdgeInsets.all(10),
// child: IconButton(
// icon: SvgPicture.asset(
// 'icons/Scan.svg',
// width: 60,
// height: 60,
// colorFilter: ColorFilter.mode(Color(0xFFFFFFFF), BlendMode.srcIn),
// ),
// onPressed: () {},
// ),
// ),
// );
// }
Widget setHomeImage(String src, double size) { Widget setHomeImage(String src, double size) {
return Image.asset(src, width: size); return Image.asset("assets/" + src, width: size);
} }
} }
class _MenuItems { class _MenuItem {
static const List<MenuItem> firstItems = [like, share, download]; const _MenuItem({required this.text, required this.icon});
static const List<MenuItem> secondItems = [cancel]; final String text;
static const like = MenuItem(text: 'Hello', icon: Icons.favorite); final IconData icon;
static const share = MenuItem(text: 'Furikake', icon: Icons.share); }
static const download = MenuItem(
text: 'Makanan Bergizi',
icon: Icons.download,
);
static const cancel = MenuItem(text: 'Cancel', icon: Icons.cancel);
static Widget buildItem(MenuItem item) { class _MenuItems {
static const List<_MenuItem> firstItems = [like, share, download];
static const List<_MenuItem> secondItems = [cancel];
static const like = _MenuItem(text: 'Like', icon: Icons.favorite);
static const share = _MenuItem(text: 'Share', icon: Icons.share);
static const download = _MenuItem(text: 'Download', icon: Icons.download);
static const cancel = _MenuItem(text: 'Cancel', icon: Icons.cancel);
static Widget buildItem(_MenuItem item) {
return Container( return Container(
height: 30, height: 30,
padding: EdgeInsets.symmetric(vertical: 2), padding: EdgeInsets.symmetric(vertical: 2),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Row( child: Row(
children: [ children: [
// Icon(item.icon, color: Color.fromRGBO(242, 240, 240, 1), size: 22),
// const SizedBox(width: 10),
Expanded( Expanded(
child: Text( child: Text(
item.text, item.text,
@@ -251,7 +347,7 @@ class _MenuItems {
); );
} }
static void onChanged(BuildContext context, MenuItem item) { static void onChanged(BuildContext context, _MenuItem item) {
switch (item) { switch (item) {
case _MenuItems.like: case _MenuItems.like:
//Do something //Do something
-101
View File
@@ -1,101 +0,0 @@
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
class CameraScreen extends StatefulWidget {
const CameraScreen({super.key});
@override
_CameraScreenState createState() => _CameraScreenState();
}
class _CameraScreenState extends State<CameraScreen> {
CameraController? controller;
List<CameraDescription>? cameras;
XFile? capturedImage;
@override
void initState() {
super.initState();
initCamera();
}
Future<void> initCamera() async {
await Permission.camera.request();
if (await Permission.camera.isGranted) {
cameras = await availableCameras();
controller = CameraController(cameras![0], ResolutionPreset.high);
await controller!.initialize();
setState(() {}); // update UI setelah kamera siap
}
}
@override
void dispose() {
controller?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (controller == null || !controller!.value.isInitialized) {
return Center(child: CircularProgressIndicator());
}
return Scaffold(
appBar: AppBar(
title: Text('Camera'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
),
body: Stack(
children: [
CameraPreview(controller!),
if (capturedImage != null)
Positioned.fill(
child: Image.file(File(capturedImage!.path), fit: BoxFit.cover),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
backgroundColor: Colors.white,
onPressed: () async {
final image = await controller!.takePicture();
setState(() {
capturedImage = image;
});
Navigator.pop(context, capturedImage?.path);
},
child: Icon(Icons.camera_alt, color: Colors.black),
),
],
),
),
),
],
),
// floatingActionButton: FloatingActionButton(
// onPressed: () async {
// final image = await controller!.takePicture();
// print('Gambar disimpan di: ${image.path}');
// // Bisa dilanjutkan untuk upload, crop, dll
// },
// child: Icon(Icons.camera_alt),
// ),
);
}
}
-92
View File
@@ -1,92 +0,0 @@
import 'package:flutter/material.dart';
import 'package:freekake/components/characcter_info.dart';
class CharacterView extends StatefulWidget {
final String title;
final String imagePath;
final String content;
// caracter info
final String charName;
final String charOrigin;
final String charSex;
const CharacterView({
super.key,
required this.title,
required this.imagePath,
required this.content,
required this.charName,
required this.charSex,
required this.charOrigin,
});
@override
_CharacterViewState createState() => _CharacterViewState();
}
class _CharacterViewState extends State<CharacterView> {
late String _content;
late String _charName;
late String _charOrigin;
late String _charSex;
@override
void initState() {
super.initState();
_content = widget.content;
_charName = widget.charName;
_charSex = widget.charSex;
_charOrigin = widget.charOrigin;
}
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text(widget.title),
backgroundColor: const Color.fromARGB(255, 79, 76, 182),
),
body: Column(
children: [
// Gambar 1/3 dari tinggi layar
SizedBox(
height: 20,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(40),
bottomRight: Radius.circular(40),
),
color: Color.fromARGB(255, 79, 76, 182),
),
),
),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: screenHeight / 2,
width: double.infinity,
child: Image.asset(widget.imagePath, fit: BoxFit.fitHeight),
),
),
// Konten text scrollable
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(18.0),
child: CharacterInfo(
nama: _charName,
kelamin: _charSex,
asal: _charOrigin,
content: _content,
),
),
),
],
),
);
}
}
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:freekake/components/collection_container.dart';
import 'package:freekake/screen/collection/character_view.dart';
class CollectionCaraterScreen extends StatefulWidget { class CollectionCaraterScreen extends StatefulWidget {
const CollectionCaraterScreen({super.key}); const CollectionCaraterScreen({super.key});
@@ -23,13 +22,7 @@ class _CollectionCaraterScreenState extends State<CollectionCaraterScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text("Favorit", style: TextStyle(color: Colors.black)),
"Favorite",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Divider(height: 20, color: Colors.transparent), Divider(height: 20, color: Colors.transparent),
SingleChildScrollView( SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@@ -39,57 +32,21 @@ class _CollectionCaraterScreenState extends State<CollectionCaraterScreen> {
// runSpacing: 10, // Vertical spacing between lines // runSpacing: 10, // Vertical spacing between lines
children: [ children: [
CollectionContainer( CollectionContainer(
label: "Cepot", label: "Luffy",
imagesrc: 'assets/images/cepott.png', imagesrc: 'assets/images/luffy.png',
colorContiner: Color.fromRGBO(237, 207, 100, 1.0), colorContiner: Color.fromRGBO(12, 199, 215, 1),
onTapAc: onTapAc: () => {},
() => {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => CharacterView(
title: "Tentang Cepot",
imagePath: 'assets/images/cepott.png',
charName: "Cepot",
charSex: "Laki-laki",
charOrigin: "Jawa Barat",
content:
"""Cepot adalah sosok yang begitu menarik—aneh, ceria, dan penuh kejutan!
Ia muncul seperti tokoh dari dongeng lama yang lupa pulang ke rumah, dengan wajah merah seperti apel matang,
hidung besar yang tampak siap mencium rahasia, dan mata bulat yang selalu bersinar penuh rasa ingin tahu. Ia suka tertawa keras,
suka bermain-main dengan kata-kata, dan sangat pandai membuat siapa pun merasa nyaman di dekatnya. \nMeski kadang terlihat konyol,
Cepot sebenarnya sangat cerdik—ia tahu kapan harus berbicara, kapan harus diam, dan yang paling penting, ia tahu bagaimana menghibur
orang-orang yang sedang sedih. \nAnak-anak menyukainya, orang tua menghormatinya, dan tak jarang hewan-hewan kecil pun tampak betah
duduk di dekatnya saat ia bercerita.
""",
), ),
CollectionContainer(
label: "Oni Chan",
imagesrc: 'assets/images/klipartz.png',
onTapAc: () => {},
), ),
),
},
),
// CollectionContainer(
// label: "Luffy",
// imagesrc: 'assets/images/luffy.png',
// colorContiner: Color.fromRGBO(12, 199, 215, 1),
// onTapAc: () => {},
// ),
// CollectionContainer(
// label: "Oni Chan",
// imagesrc: 'assets/images/klipartz.png',
// onTapAc: () => {},
// ),
], ],
), ),
), ),
Divider(height: 20, color: Colors.transparent), Divider(height: 20, color: Colors.transparent),
Text( Text("Semua", style: TextStyle(color: Colors.black)),
"All",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
Divider(height: 20, color: Colors.transparent), Divider(height: 20, color: Colors.transparent),
SingleChildScrollView( SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@@ -98,52 +55,22 @@ class _CollectionCaraterScreenState extends State<CollectionCaraterScreen> {
spacing: 10, // Horizontal spacing between the containers spacing: 10, // Horizontal spacing between the containers
// runSpacing: 10, // Vertical spacing between lines // runSpacing: 10, // Vertical spacing between lines
children: [ children: [
// CollectionContainer( CollectionContainer(
// label: "Luffy", label: "Luffy",
// imagesrc: 'assets/images/luffy.png', imagesrc: 'assets/images/luffy.png',
// colorContiner: Color.fromRGBO(12, 199, 215, 1), colorContiner: Color.fromRGBO(12, 199, 215, 1),
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
// CollectionContainer( CollectionContainer(
// label: "Oni Chan", label: "Oni Chan",
// imagesrc: 'assets/images/klipartz.png', imagesrc: 'assets/images/klipartz.png',
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
CollectionContainer( CollectionContainer(
label: "Cepot", label: "Cepot",
imagesrc: 'assets/images/cepott.png', imagesrc: 'assets/images/cepott.png',
colorContiner: Color.fromRGBO(237, 207, 100, 1.0), colorContiner: Color.fromRGBO(237, 207, 100, 1.0),
onTapAc: onTapAc: () => {},
() => {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => CharacterView(
title: "Tentang Cepot",
imagePath: 'assets/images/cepott.png',
charName: "Cepot",
charSex: "Laki-laki",
charOrigin: "Jawa Barat",
content: """
Cepot adalah sosok yang begitu menarik—aneh,
ceria, dan penuh kejutan! Ia muncul seperti
tokoh dari dongeng lama yang lupa pulang ke rumah,
dengan wajah merah seperti apel matang,
hidung besar yang tampak siap
mencium rahasia, dan mata bulat
yang selalu bersinar penuh rasa ingin
tahu. Ia suka tertawa keras, suka bermain-main dengan kata-kata, dan sangat
pandai membuat siapa pun merasa nyaman di dekatnya. \nMeski kadang terlihat konyol,
Cepot sebenarnya sangat cerdik—ia tahu kapan harus berbicara, kapan harus diam, dan
yang paling penting, ia tahu bagaimana menghibur orang-orang yang sedang sedih. \nAnak-anak
menyukainya, orang tua menghormatinya, dan tak jarang hewan-hewan kecil pun tampak betah duduk
di dekatnya saat ia bercerita.
""",
),
),
),
},
), ),
], ],
), ),
@@ -27,14 +27,14 @@ class _CollectionFragmentScreenState extends State<CollectionFragmentScreen> {
spacing: 10, // Horizontal spacing between the containers spacing: 10, // Horizontal spacing between the containers
runSpacing: 10, // Vertical spacing between lines runSpacing: 10, // Vertical spacing between lines
children: [ children: [
// CollectionContainer(
// label: "Luffy",
// imagesrc: 'assets/images/ft_luffy.png',
// onTapAc: () => {},
// colorContiner: ColorHelper.hexToColor("0xE2E5E9"),
// ),
CollectionContainer( CollectionContainer(
label: "Cepot", label: "Luffy",
imagesrc: 'assets/images/ft_luffy.png',
onTapAc: () => {},
colorContiner: ColorHelper.hexToColor("0xE2E5E9"),
),
CollectionContainer(
label: "Oni Chan",
imagesrc: 'assets/images/ft_cepot.png', imagesrc: 'assets/images/ft_cepot.png',
onTapAc: () => {}, onTapAc: () => {},
colorContiner: ColorHelper.hexToColor("0xE2E5E9"), colorContiner: ColorHelper.hexToColor("0xE2E5E9"),
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:freekake/components/collection_container.dart';
import 'package:freekake/screen/collection/character_view.dart';
import 'package:freekake/screen/collection/skin_view.dart';
class CollectionSkinScreen extends StatefulWidget { class CollectionSkinScreen extends StatefulWidget {
const CollectionSkinScreen({super.key}); const CollectionSkinScreen({super.key});
@@ -13,7 +11,7 @@ class CollectionSkinScreen extends StatefulWidget {
class _CollectionSkinScreenState extends State<CollectionSkinScreen> { class _CollectionSkinScreenState extends State<CollectionSkinScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return Container(
// scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Column( child: Column(
@@ -25,70 +23,53 @@ class _CollectionSkinScreenState extends State<CollectionSkinScreen> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Text("Luffy", style: TextStyle(color: Colors.black)), Text("Luffy", style: TextStyle(color: Colors.black)),
// Divider(height: 10), Divider(height: 10),
// SingleChildScrollView( SingleChildScrollView(
// scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
// child: Row( child: Row(
// spacing: 10, // Horizontal spacing between the containers spacing: 10, // Horizontal spacing between the containers
// children: [ children: [
// CollectionContainer( CollectionContainer(
// label: "Luffy Kimono", label: "Luffy Kimono",
// imagesrc: 'assets/images/luffy-kimono.png', imagesrc: 'assets/images/luffy-kimono.png',
// colorContiner: Color.fromRGBO(12, 199, 215, 1), colorContiner: Color.fromRGBO(12, 199, 215, 1),
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
// CollectionContainer( CollectionContainer(
// label: "Luffy (Default)", label: "Luffy (Default)",
// imagesrc: 'assets/images/luffy.png', imagesrc: 'assets/images/luffy.png',
// colorContiner: Color.fromRGBO(12, 199, 215, 1), colorContiner: Color.fromRGBO(12, 199, 215, 1),
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
// CollectionContainer( CollectionContainer(
// label: "Luffy King", label: "Luffy King",
// imagesrc: 'assets/images/luffy-king.png', imagesrc: 'assets/images/luffy-king.png',
// colorContiner: Color.fromRGBO(12, 199, 215, 1), colorContiner: Color.fromRGBO(12, 199, 215, 1),
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
// ], ],
// ), ),
// ), ),
// Divider(height: 20, color: Colors.transparent), Divider(height: 20, color: Colors.transparent),
Text("Cepot", style: TextStyle(color: Colors.black)), Text("Lainnya", style: TextStyle(color: Colors.black)),
Divider(height: 10), Divider(height: 10),
SingleChildScrollView( SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
spacing: 10, spacing: 10,
children: [ children: [
// CollectionContainer( CollectionContainer(
// label: "Oni Chan (Default)", label: "Oni Chan (Default)",
// imagesrc: 'assets/images/klipartz.png', imagesrc: 'assets/images/klipartz.png',
// onTapAc: () => {}, onTapAc: () => {},
// ), ),
CollectionContainer( CollectionContainer(
label: "Cepot (Default)", label: "Cepot (Default)",
imagesrc: 'assets/images/cepott.png', imagesrc: 'assets/images/cepott.png',
colorContiner: Color.fromRGBO(237, 207, 100, 1.0), colorContiner: Color.fromRGBO(237, 207, 100, 1.0),
onTapAc: onTapAc: () => {},
() => {
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => SkinView(
title: "Tentang Skin",
imagePath: 'assets/images/cepott.png',
skinName: "Pangsi",
skinOrigin: "Jawa Barat",
content:
"""Pakaian Cepot juga punya makna, lho! Ia selalu memakai baju pangsi hitam panjang yang sederhana, melambangkan kesederhanaan dan kerendahan hati. \nBaju ini longgar dan nyaman, cocok untuk Cepot yang suka bergerak bebas dan menghibur orang-orang di sekitarnya. \nSarung kotak-kotak yang dililit di pinggang bukan hanya pelengkap, tapi juga simbol budaya rakyat biasa yang tetap rapi dan terhormat. \nDan jangan lupa iket batik di kepalanya—itu bukan cuma hiasan, tapi lambang kebanggaan dan identitas sebagai orang Sunda. Lewat pakaiannya, Cepot mengajarkan kita bahwa kita tidak perlu pakaian mahal untuk terlihat hebat. Yang penting adalah sikap baik, rasa hormat pada budaya, dan keberanian untuk jadi diri sendiri!
""",
),
),
),
},
), ),
], ],
), ),
-87
View File
@@ -1,87 +0,0 @@
import 'package:flutter/material.dart';
import 'package:freekake/components/characcter_info.dart';
import 'package:freekake/components/skin_info.dart';
class SkinView extends StatefulWidget {
final String title;
final String imagePath;
final String content;
// caracter info
final String skinName;
final String skinOrigin;
const SkinView({
super.key,
required this.title,
required this.imagePath,
required this.content,
required this.skinName,
required this.skinOrigin,
});
@override
_SkinViewState createState() => _SkinViewState();
}
class _SkinViewState extends State<SkinView> {
late String _content;
late String _skinName;
late String _skinOrigin;
@override
void initState() {
super.initState();
_content = widget.content;
_skinName = widget.skinName;
_skinOrigin = widget.skinOrigin;
}
@override
Widget build(BuildContext context) {
final screenHeight = MediaQuery.of(context).size.height;
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text(widget.title),
backgroundColor: const Color.fromARGB(255, 79, 76, 182),
),
body: Column(
children: [
SizedBox(
height: 20,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(40),
bottomRight: Radius.circular(40),
),
color: Color.fromARGB(255, 79, 76, 182),
),
),
),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: screenHeight / 2,
width: double.infinity,
child: Image.asset(widget.imagePath, fit: BoxFit.fitHeight),
),
),
// Konten text scrollable
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(18.0),
child: SkinInfo(
nama: _skinName,
asal: _skinOrigin,
content: _content,
),
),
),
],
),
);
}
}
+4 -15
View File
@@ -36,21 +36,9 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final buttonScanSize = screenWidth * 0.20;
final double bottomPadding = (9000 / screenWidth).clamp(0, 0.2);
return Scaffold( return Scaffold(
extendBody: true, extendBody: true,
body: koleksiBody(bottomPadding, screenWidth, buttonScanSize), body: Stack(
);
}
Stack koleksiBody(
double bottomPadding,
double screenWidth,
double buttonScanSize,
) {
return Stack(
children: <Widget>[ children: <Widget>[
Positioned.fill( Positioned.fill(
child: Container(color: const Color.fromARGB(255, 255, 255, 255)), child: Container(color: const Color.fromARGB(255, 255, 255, 255)),
@@ -162,14 +150,15 @@ class _KoleksiScreenState extends State<KoleksiScreen> {
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: bottomPadding * 98, bottom: 8,
left: (screenWidth - buttonScanSize) / 2, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),
), ),
), ),
], ],
),
); );
} }
} }
-105
View File
@@ -1,105 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:webview_flutter/webview_flutter.dart';
class _ListDetailScreen extends StatefulWidget {
final String title;
final String? filepath;
const _ListDetailScreen({super.key, required this.title, this.filepath});
@override
State<_ListDetailScreen> createState() => _ListDetailScreenState();
}
class _ListDetailScreenState extends State<_ListDetailScreen> {
List<bool> checklist = [];
late WebViewController _controller;
late String? fPath = widget.filepath;
@override
void initState() {
super.initState();
_controller =
WebViewController()..setJavaScriptMode(JavaScriptMode.unrestricted);
checklist = List.generate(paragraphs.length, (index) => false);
if (fPath != null && fPath!.isNotEmpty) {
_loadContent(fPath!); // <- ini penting
}
}
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.",
];
void _loadContent(String path) async {
try {
if (path.startsWith('http')) {
_controller.loadRequest(Uri.parse(path));
} else {
String fileHtml = await rootBundle.loadString(path);
_controller.loadHtmlString(fileHtml);
}
} catch (e) {
debugPrint("Error loading HTML: $e");
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: Text(widget.title)),
body:
(fPath != null && fPath!.isNotEmpty)
? WebViewWidget(controller: _controller)
: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
'assets/images/default.png',
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),
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!;
});
},
),
);
},
),
),
],
),
),
);
}
}
+57 -108
View File
@@ -1,133 +1,82 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'dart:convert';
class ListDetailScreen extends StatefulWidget { class ListDetailScreen extends StatefulWidget {
final String title; final String title;
final String? filepath;
const ListDetailScreen({super.key, required this.title, this.filepath}); const ListDetailScreen({super.key, required this.title});
@override @override
State<ListDetailScreen> createState() => _ListDetailScreenState(); State<ListDetailScreen> createState() => _ListDetailScreenState();
} }
class _ListDetailScreenState extends State<ListDetailScreen> { class _ListDetailScreenState extends State<ListDetailScreen> {
late InAppWebViewController _webViewController; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String _getMimeType(String path) {
if (path.endsWith('.png')) return 'image/png';
if (path.endsWith('.jpg') || path.endsWith('.jpeg')) return 'image/jpeg';
if (path.endsWith('.svg')) return 'image/svg+xml';
if (path.endsWith('.html')) return 'text/html';
if (path.endsWith('.css')) return 'text/css';
if (path.endsWith('.js')) return 'application/javascript';
return 'application/octet-stream';
}
return Scaffold( return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: Text(widget.title)), appBar: AppBar(title: Text(widget.title)),
body: body: Padding(
widget.filepath != null padding: const EdgeInsets.all(16.0),
? InAppWebView( child: Column(
initialUrlRequest: URLRequest(url: WebUri("about:blank")), children: [
initialOptions: InAppWebViewGroupOptions( // Gambar di kiri atas dengan teks di kanan
crossPlatform: InAppWebViewOptions( Row(
javaScriptEnabled: true, crossAxisAlignment: CrossAxisAlignment.start,
allowFileAccessFromFileURLs: true, children: [
allowUniversalAccessFromFileURLs: true, Image.asset(
'assets/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),
), ),
), ),
onWebViewCreated: (controller) async { ],
_webViewController = controller; ),
const SizedBox(height: 20),
final html = await rootBundle.loadString(widget.filepath!); // Paragraf dengan checklist
final base = widget.filepath!.substring( Expanded(
0, child: ListView.builder(
widget.filepath!.lastIndexOf('/') + 1, itemCount: paragraphs.length,
); itemBuilder: (context, index) {
await controller.loadData( return ListTile(
data: html, title: Text(paragraphs[index]),
baseUrl: WebUri( trailing: Checkbox(
"file:///android_asset/flutter_assets/$base", value: checklist[index],
), // agar path relatif seperti img1/* jalan onChanged: (bool? value) {
mimeType: 'text/html', setState(() {
encoding: 'utf-8', checklist[index] = value!;
); });
debugPrint("http://localhost/$base");
debugPrint("file:///android_asset/flutter_assets/$base");
}, },
onLoadStop: (controller, url) async { ),
debugPrint("🚀 onLoadStop called. URL: $url");
var result = await controller.evaluateJavascript(
source: """
(() => {
const board = document.getElementById('game-board');
const hasRender = typeof renderGrid === 'function';
return { hasRender, boardExists: board !== null };
})();
""",
); );
debugPrint("📊 Evaluated JS result: $result");
final jsCheck = await controller.evaluateJavascript(
source: """
typeof renderGrid === 'function' &&
document.querySelector('#game-board') !== null
""",
);
debugPrint(
"Apakah renderGrid tersedia dan board muncul? => $jsCheck",
);
final imageLoaded = await controller.evaluateJavascript(
source: """
Array.from(document.images).every(img => img.complete)
""",
);
debugPrint("Semua gambar berhasil dimuat? => $imageLoaded");
}, },
),
// (Opsional) tangkap log dari JS ),
onConsoleMessage: (controller, consoleMessage) { ],
debugPrint("📢 JS Console: ${consoleMessage.message}"); ),
}, ),
shouldInterceptRequest: (controller, request) async {
final url = request.url;
if (url == null || url.host != 'localhost') return null;
try {
// Strip "http://localhost/" from the path
final path = url.path.replaceFirst('/', '');
final asset = await rootBundle.load(path);
final mimeType = _getMimeType(path);
return WebResourceResponse(
contentType: mimeType,
data: asset.buffer.asUint8List(),
statusCode: 200,
reasonPhrase: 'OK',
);
} catch (e) {
print("⚠️ Asset not found: ${url.path} -> $e");
return WebResourceResponse(
contentType: 'text/plain',
data: Uint8List.fromList(utf8.encode('404 Not Found')),
statusCode: 404,
reasonPhrase: 'Not Found',
);
}
},
)
: const Center(child: Text("Tidak ada file HTML")),
); );
} }
} }
+144 -274
View File
@@ -1,22 +1,14 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:freekake/components/buildcard_info.dart';
import 'package:freekake/components/card_list.dart'; import 'package:freekake/components/card_list.dart';
import 'package:freekake/components/collection_container%20copy.dart'; import 'package:freekake/components/collection_container%20copy.dart';
import 'package:freekake/components/main_menu.dart';
import 'package:freekake/components/topbar_container.dart';
import 'package:freekake/screen/pustaka/pustaka_detail_screen.dart';
import 'package:freekake/helpers/color_helper.dart'; import 'package:freekake/helpers/color_helper.dart';
import 'package:freekake/models/users.dart';
import 'package:freekake/screen/pustaka/list_detail_screen.dart';
import 'package:freekake/util/api_client.dart';
import 'package:list_detail_extension/list_detail_extension.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:dio/dio.dart';
class ListEducation extends StatefulWidget { class ListEducation extends StatefulWidget {
final String? selectedCategory; const ListEducation({super.key});
const ListEducation({super.key, this.selectedCategory});
@override @override
State<ListEducation> createState() => _ListEducationState(); State<ListEducation> createState() => _ListEducationState();
@@ -24,22 +16,6 @@ class ListEducation extends StatefulWidget {
class _ListEducationState extends State<ListEducation> { class _ListEducationState extends State<ListEducation> {
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
late final WebViewController _controller;
late String urlOrAssetPath;
bool _shouldShowWebView = false;
String? selectedCategory;
final listDetailExtension = ListDetailExtension();
// Data fetch
final ApiClient _apiClient = ApiClient();
List<Users> _posts = [];
bool _isLoading = true;
String _error = '';
Future<void> _initExtension() async {
await listDetailExtension.load();
}
List<String> allItems = [ List<String> allItems = [
"Matematika", "Matematika",
"Fisika", "Fisika",
@@ -48,170 +24,27 @@ class _ListEducationState extends State<ListEducation> {
"Sejarah", "Sejarah",
"Geografi", "Geografi",
]; ];
List<String> filteredItems = [];
final List<Map<String, dynamic>> _listContent = [
{
"title": "Taburan Lezat untuk Nasi!",
"image": "assets/html/furikake/furikake.jpg",
"color": "#cdd0ee",
"category": "Kesehatan",
"type": "Materi",
"point": "10",
"coint": "100",
"body":
"""Tahukah kamu bahwa di Jepang ada bumbu tabur yang bisa membuat nasi
menjadi lebih enak?
""",
"file": "assets/html/furikake/index.html",
},
{
"title": "Makan Sehat dengan Gizi Seimbang",
"image": "assets/html/lemak.png",
"color": "#cef1da",
"category": "Keselamatan",
"type": "Materi",
"point": "100",
"coint": "20",
"body":
"""upaya makan kita sehat, ada aturan "Isi Piringku" yang bisa kita ikuti:
🍽️ Separuh piring: Sayur dan buah 🍽️ Seperempat piring: Karbohidrat (seperti nasi atau roti)
🍽️ Seperempat piring: Protein (seperti ayam atau tempe) 🍽️ Sedikit lemak sehat
""",
"file": "assets/html/index.html",
},
{
"title": "Memori Game",
"image": "assets/html/freekake.png",
"color": "#cef1da",
"category": "Gizi",
"type": "Materi",
"point": "100",
"coint": "20",
"body":
"""Game untuk melatih daya ingat siswa, sehingga bisa diharapkan bisa
menemukan cara sendiri untuk mengingat sesuatu
""",
"file": "assets/html/memory/memory.html",
},
{
"title": "Find Words",
"image": "assets/html/freekake.png",
"color": "#cef1da",
"category": "Kesehatan",
"type": "Materi",
"point": "100",
"coint": "20",
"body": """
No Descripptions
""",
"file": "assets/html/findwords/findwords.html",
},
];
List<Map<String, dynamic>> filteredItems = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
filteredItems = List.from(allItems);
selectedCategory = widget.selectedCategory;
print(selectedCategory);
if (selectedCategory != null && selectedCategory!.isNotEmpty) {
filteredItems =
_listContent
.where((item) => item["category"] == selectedCategory)
.toList();
} else {
filteredItems = List.from(_listContent);
}
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
_shouldShowWebView = true;
_controller =
WebViewController()..setJavaScriptMode(JavaScriptMode.unrestricted);
urlOrAssetPath = "assets/html/index.html";
_loadContent(urlOrAssetPath);
_initExtension();
}
}
void _loadContent(String path) async {
if (_shouldShowWebView) {
if (path.startsWith('http')) {
// Load dari Internet
_controller.loadRequest(Uri.parse(path));
} else {
try {
await rootBundle.load(path);
await _controller.loadFlutterAsset(path);
} catch (e) {
print("Gagal memuat file HTML: $path\nError: $e");
}
_controller.loadFlutterAsset(path);
}
}
} }
void filterSearch(String query) { void filterSearch(String query) {
setState(() { setState(() {
selectedCategory = null;
if (query.isEmpty) {
filteredItems = List.from(_listContent);
} else {
filteredItems = filteredItems =
_listContent.where((item) { allItems
return item["title"].toLowerCase().contains(query.toLowerCase()); .where((item) => item.toLowerCase().contains(query.toLowerCase()))
}).toList(); .toList();
}
}); });
} }
void filterByCategory(String category) {
setState(() {
selectedCategory = category;
filteredItems =
_listContent.where((item) {
return item["category"].toLowerCase() == category.toLowerCase();
}).toList();
});
}
Future<void> _fetchPosts() async {
try {
setState(() {
_isLoading = true;
_error = '';
});
// Melakukan permintaan GET ke endpoint
final Response response = await _apiClient.dio.get('auth/users');
if (response.statusCode == 200) {
// Konversi data JSON ke List
List<dynamic> postJson = response.data;
_posts = postJson.map((json) => Users.fromJson(json)).toList();
} else {
_error = 'Gagal memuat data: ${response.statusCode}';
}
} on DioException catch (e) {
if (e.response != null) {
_error =
'Server Error: ${e.response?.statusCode} - ${e.response?.statusMessage}';
} else {
_error = 'Network Error: ${e.message}';
}
print('DioError: $e');
} catch (e) {
_error = 'Terjadi kesalahan tidak terduga: $e';
print('General Error: $e');
} finally {
setState(() {
_isLoading = false;
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<Map<String, dynamic>> collections = [ String _searchQuery = "";
final List<Map<String, dynamic>> _collections = [
{ {
"label": "Kesehatan", "label": "Kesehatan",
"image": "assets/icons/healthy.svg", "image": "assets/icons/healthy.svg",
@@ -237,17 +70,14 @@ class _ListEducationState extends State<ListEducation> {
"category": "keselamatan", "category": "keselamatan",
}, },
]; ];
List<Map<String, dynamic>> filteredCollections =
final List<Map<String, dynamic>> filteredCollections = _collections
collections
.where( .where(
(item) => item["label"].toLowerCase().contains( (item) => item["label"]!.toLowerCase().contains(
// searchQuery.toLowerCase(), _searchQuery.toLowerCase(),
searchController.text.toLowerCase(),
), ),
) )
.toList(); .toList();
if (_shouldShowWebView) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: Color.fromARGB(225, 79, 76, 182), backgroundColor: Color.fromARGB(225, 79, 76, 182),
@@ -261,28 +91,7 @@ class _ListEducationState extends State<ListEducation> {
body: Column( body: Column(
children: [ children: [
// Header Section // Header Section
headerContainer(context, collections), Container(
// Collection Items dengan Filter
SizedBox(height: 20),
Expanded(child: contentContainer(context)),
],
),
);
} else {
return const Center(
child: Padding(
padding: EdgeInsets.all(40),
child: Text("WebView tidak tersedia untuk platform ini."),
),
);
}
}
Container headerContainer(
BuildContext context,
List<Map<String, dynamic>> filteredCollections,
) {
return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: 150, height: 150,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -295,7 +104,10 @@ class _ListEducationState extends State<ListEducation> {
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6), padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 6,
),
child: Container( child: Container(
height: 47, height: 47,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -314,8 +126,12 @@ class _ListEducationState extends State<ListEducation> {
Expanded( Expanded(
child: TextField( child: TextField(
controller: searchController, controller: searchController,
onChanged: filterSearch, // Memanggil filter saat mengetik onChanged:
style: const TextStyle(color: Colors.black, fontSize: 14), filterSearch, // Memanggil filter saat mengetik
style: const TextStyle(
color: Colors.black,
fontSize: 14,
),
decoration: const InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: 'Cari pelajaran...', hintText: 'Cari pelajaran...',
@@ -325,7 +141,10 @@ class _ListEducationState extends State<ListEducation> {
), ),
if (searchController.text.isNotEmpty) if (searchController.text.isNotEmpty)
IconButton( IconButton(
icon: const Icon(Icons.close, color: Colors.black54), icon: const Icon(
Icons.close,
color: Colors.black54,
),
onPressed: () { onPressed: () {
searchController.clear(); searchController.clear();
filterSearch(''); filterSearch('');
@@ -340,7 +159,6 @@ class _ListEducationState extends State<ListEducation> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: children:
filteredCollections.map((item) { filteredCollections.map((item) {
final isSelected = selectedCategory == item["category"];
return CollectionContainer( return CollectionContainer(
label: item["label"]!, label: item["label"]!,
imageSvg: item["image"]!, imageSvg: item["image"]!,
@@ -348,44 +166,76 @@ class _ListEducationState extends State<ListEducation> {
iconh: 20, iconh: 20,
width: 70, width: 70,
height: 70, height: 70,
textColor: textColor: Colors.black,
isSelected
? const Color.fromARGB(255, 230, 48, 160)
: Colors.black,
lblSize: 10, lblSize: 10,
// colorContiner: ColorHelper.hexToColor(item["color"]), colorContiner: ColorHelper.hexToColor(item["color"]),
colorContiner:
isSelected
? const Color.fromARGB(255, 84, 3, 224)
: ColorHelper.hexToColor(item["color"]),
onTapAc: onTapAc:
() => { () => {
searchController.clear(), searchController.clear(),
filterByCategory(item["category"]), filterSearch(item["category"]),
}, },
); );
}).toList(), }).toList(),
), ),
], ],
), ),
); ),
}
Container contentContainer(BuildContext context) { // Search Bar
return Container( // 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( decoration: BoxDecoration(
color: const Color.fromARGB(223, 200, 200, 206), color: const Color.fromARGB(224, 145, 145, 155),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(25), topLeft: Radius.circular(25),
topRight: Radius.circular(25), topRight: Radius.circular(25),
), ),
), ),
child: _listCard(context), child: Column(
);
}
Column _listCard(BuildContext context) {
return Column(
children: [ children: [
SizedBox(height: 5), SizedBox(height: 5),
Padding( Padding(
@@ -393,10 +243,11 @@ class _ListEducationState extends State<ListEducation> {
horizontal: MediaQuery.of(context).size.width / 4, horizontal: MediaQuery.of(context).size.width / 4,
), ),
child: Divider( child: Divider(
color: const Color.fromARGB(255, 255, 255, 255), color: const Color.fromARGB(255, 155, 147, 147),
thickness: 2, height: 20,
), ),
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -408,18 +259,30 @@ class _ListEducationState extends State<ListEducation> {
? const Center( ? const Center(
child: Text( child: Text(
"Tidak ada hasil", "Tidak ada hasil",
style: TextStyle(fontSize: 16, color: Colors.black54), style: TextStyle(
fontSize: 16,
color: Colors.black54,
),
), ),
) )
: Padding( : Padding(
padding: EdgeInsets.only(top: 10.0, left: 10, right: 10), padding: EdgeInsets.only(
top: 20.0,
left: 20,
right: 20,
),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
topRight: Radius.circular(20), topRight: Radius.circular(20),
), ),
color: const Color.fromARGB(255, 222, 181, 133), color: const Color.fromARGB(
255,
222,
181,
133,
),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
@@ -427,20 +290,10 @@ class _ListEducationState extends State<ListEducation> {
right: 20, right: 20,
left: 20, left: 20,
), ),
child: _generateList(), child: GridView.builder(
), gridDelegate:
), const SliverGridDelegateWithFixedCrossAxisCount(
), crossAxisCount: 1, // 2 Kolom
),
),
],
);
}
GridView _generateList() {
return GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
crossAxisSpacing: 10, crossAxisSpacing: 10,
mainAxisSpacing: 10, mainAxisSpacing: 10,
childAspectRatio: 2.5, childAspectRatio: 2.5,
@@ -448,38 +301,55 @@ class _ListEducationState extends State<ListEducation> {
itemCount: filteredItems.length, itemCount: filteredItems.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
child: CardList( child: CardList(),
title: filteredItems[index]["title"] ?? "",
body: filteredItems[index]["body"] ?? "",
gambar: filteredItems[index]['image'],
point: filteredItems[index]['point'],
coint: filteredItems[index]['coint'],
tipe: filteredItems[index]['type'],
),
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder:
// (context) => listDetailExtension.buildPage({ (
// 'title': filteredItems[index]['category'], context,
// 'imagePath': filteredItems[index]['image'], ) => ListDetailScreen(
// 'filepath': filteredItems[index]['file'], title:
// 'paragraphs': filteredItems[index],
// """ imagePath:
// """ filteredItems[index],
// "<h1> ${filteredItems[index]["title"]} </h1> <p> ${filteredItems[index]["body"]}", paragraphs: [
// }), """
(context) => ListDetailScreen( <h1>Enter the main heading, usually the same as the title.</h1>
title: filteredItems[index]['category'], <p>Be <b>bold</b> in stating your key points. Put them in a list: </p>
// 'imagePath': filteredItems[index]['image'], <ul>
filepath: filteredItems[index]['file'], <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(),
],
),
); );
} }
} }
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:freekakes/components/buildcard_info.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:freekake/components/collection_container.dart';
class DetailScreen extends StatefulWidget { class DetailScreen extends StatefulWidget {
+95 -96
View File
@@ -1,34 +1,29 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
class ListPustakaDetailScreen extends StatefulWidget { class ListDetailScreen extends StatefulWidget {
final String title; final String title;
final String imagePath; final String imagePath;
final String paragraphs; final List<String> paragraphs;
final String filepath;
const ListPustakaDetailScreen({ const ListDetailScreen({
super.key, Key? key,
required this.title, required this.title,
required this.imagePath, required this.imagePath,
required this.paragraphs, required this.paragraphs,
required this.filepath, }) : super(key: key);
});
@override @override
_ListDetailScreenState createState() => _ListDetailScreenState(); _ListDetailScreenState createState() => _ListDetailScreenState();
} }
class _ListDetailScreenState extends State<ListPustakaDetailScreen> { class _ListDetailScreenState extends State<ListDetailScreen> {
late List<bool> _readStatus; late List<bool> _readStatus;
String _htmlContent = '';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_readStatus = List.generate(widget.paragraphs.length, (index) => false); _readStatus = List.generate(widget.paragraphs.length, (index) => false);
loadHtml();
} }
void _toggleReadStatus(int index) { void _toggleReadStatus(int index) {
@@ -37,20 +32,6 @@ class _ListDetailScreenState extends State<ListPustakaDetailScreen> {
}); });
} }
Future<void> loadHtml() async {
String html = await DefaultAssetBundle.of(
context,
).loadString(widget.filepath);
html = html.replaceAllMapped(
RegExp(r'<div class="gizi-grid">(.*?)</div>', dotAll: true),
(match) => '<gizi-grid>${match.group(1)}</gizi-grid>',
);
setState(() {
_htmlContent = html;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@@ -74,11 +55,96 @@ class _ListDetailScreenState extends State<ListPustakaDetailScreen> {
), ),
), ),
), ),
const SizedBox(height: 0), 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( Expanded(
child: SingleChildScrollView( child: Text(
padding: const EdgeInsets.only(left: 18.0, right: 18, bottom: 18), widget.title,
child: htmlBody(), 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);
// },
// ),
],
),
);
},
),
), ),
), ),
], ],
@@ -86,71 +152,4 @@ class _ListDetailScreenState extends State<ListPustakaDetailScreen> {
// ), // ),
); );
} }
Html htmlBody() {
return Html(
style: {"body": Style(color: const Color.fromRGBO(0, 0, 0, 1))},
// data: widget.paragraphs,
data: _htmlContent,
extensions: [
TagExtension(
tagsToExtend: {"img"},
builder: (ExtensionContext context) {
final attrs = context.attributes;
final src = attrs['src'] ?? '';
if (src.isNotEmpty) {
if (src.startsWith('assets/html/')) {
return Image.asset(
src,
width: 100,
errorBuilder:
(context, error, stackTrace) =>
const Text('Image not found'),
);
} else if (!src.startsWith('http')) {
return Image.asset(
'assets/images/$src',
width: 100,
errorBuilder:
(context, error, stackTrace) =>
const Text('Image not found'),
);
} else {
return Image.network(
src,
width: 100,
errorBuilder:
(context, error, stackTrace) =>
const Text('Image failed to load'),
);
}
}
return const SizedBox();
},
),
TagExtension(
tagsToExtend: {"gizi-grid"},
builder: (context) {
final spans = context.inlineSpanChildren ?? [];
final widgets =
spans.map((span) {
if (span is WidgetSpan) return span.child;
return const SizedBox();
}).toList();
return Wrap(
spacing: 12,
runSpacing: 12,
children:
widgets.map((child) {
return SizedBox(width: 160, child: child);
}).toList(),
);
},
),
],
);
}
} }
+7 -7
View File
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:furibase/components/buildcard_info.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:furibase/components/collection_container.dart';
import 'package:freekake/components/menu_button.dart'; import 'package:furibase/components/menu_button.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:furibase/components/scan_button.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:furibase/screen/Home_screen.dart';
import 'package:freekake/screen/pustaka/list_education.dart'; import 'package:furibase/screen/pustaka/list_education.dart';
class PustakaScreen extends StatefulWidget { class PustakaScreen extends StatefulWidget {
const PustakaScreen({super.key}); const PustakaScreen({super.key});
@@ -108,7 +108,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
children: [ children: [
CollectionContainer( CollectionContainer(
label: "Luffy", label: "Luffy",
imagesrc: 'images/luffy.png', imagesrc: 'assets/images/luffy.png',
width: 100, width: 100,
height: 100, height: 100,
onTapAc: onTapAc:
+6 -6
View File
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:furibase/components/buildcard_info.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:furibase/components/collection_container.dart';
import 'package:freekake/components/menu_button.dart'; import 'package:furibase/components/menu_button.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:furibase/components/scan_button.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:furibase/screen/Home_screen.dart';
import 'package:freekake/screen/pustaka/list_education.dart'; import 'package:furibase/screen/pustaka/list_education.dart';
class PustakaScreen extends StatefulWidget { class PustakaScreen extends StatefulWidget {
const PustakaScreen({super.key}); const PustakaScreen({super.key});
+7 -7
View File
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/buildcard_info.dart'; import 'package:furibase/components/buildcard_info.dart';
import 'package:freekake/components/collection_container.dart'; import 'package:furibase/components/collection_container.dart';
import 'package:freekake/components/menu_button.dart'; import 'package:furibase/components/menu_button.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:furibase/components/scan_button.dart';
import 'package:freekake/screen/Home_screen.dart'; import 'package:furibase/screen/Home_screen.dart';
import 'package:freekake/screen/pustaka/list_education.dart'; import 'package:furibase/screen/pustaka/list_education.dart';
class PustakaScreen extends StatefulWidget { class PustakaScreen extends StatefulWidget {
const PustakaScreen({super.key}); const PustakaScreen({super.key});
@@ -108,7 +108,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
children: [ children: [
CollectionContainer( CollectionContainer(
label: "Luffy", label: "Luffy",
imagesrc: 'images/luffy.png', imagesrc: 'assets/images/luffy.png',
width: 100, width: 100,
height: 100, height: 100,
onTapAc: onTapAc:
+59 -99
View File
@@ -44,32 +44,6 @@ class _PustakaScreenState extends State<PustakaScreen> {
}, },
]; ];
final List<Map<String, dynamic>> _genres = [
{
"label": "Game",
"type": "game",
"image": "assets/icons/healthy.svg",
"color": "#cdd0ee",
},
{
"label": "Novel",
"image": "assets/icons/Nutrition.svg",
"color": "#e8e29a",
},
{
"label": "TTS",
"type": "puzzle",
"image": "assets/icons/Education.svg",
"color": "#efd8c6",
},
{
"label": "Pazzle",
"type": "puzzle",
"image": "assets/icons/Safety.svg",
"color": "#cef1da",
},
];
void _onMenuTapped(int index) { void _onMenuTapped(int index) {
setState(() { setState(() {
_selectedIndex = index; _selectedIndex = index;
@@ -83,47 +57,18 @@ class _PustakaScreenState extends State<PustakaScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width; List<Map<String, dynamic>> filteredCollections =
final buttonScanSize = screenWidth * 0.20; _collections
final double bottomPadding = (9000 / screenWidth).clamp(0, 0.2);
List<Map<String, dynamic>> filterCollections(
List<Map<String, dynamic>> collections,
String query,
) {
return collections
.where( .where(
(item) => (item) => item["label"]!.toLowerCase().contains(
item["label"]!.toLowerCase().contains(query.toLowerCase()), _searchQuery.toLowerCase(),
),
) )
.toList(); .toList();
}
List<Map<String, dynamic>> filteredCollections = filterCollections(
_collections,
_searchQuery,
);
return Scaffold( return Scaffold(
backgroundColor: const Color.fromARGB(255, 255, 255, 255), backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: pustakaBody( body: Stack(
filteredCollections,
context,
bottomPadding,
screenWidth,
buttonScanSize,
),
);
}
Stack pustakaBody(
List<Map<String, dynamic>> filteredCollections,
BuildContext context,
double bottomPadding,
double screenWidth,
double buttonScanSize,
) {
return Stack(
children: [ children: [
//Top Bar //Top Bar
Positioned( Positioned(
@@ -137,7 +82,12 @@ class _PustakaScreenState extends State<PustakaScreen> {
// Header Section // Header Section
Container( Container(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
color: const Color.fromARGB(250, 255, 255, 255).withOpacity(0.0), color: const Color.fromARGB(
250,
255,
255,
255,
).withOpacity(0.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@@ -156,9 +106,22 @@ class _PustakaScreenState extends State<PustakaScreen> {
], ],
), ),
), ),
// // Date Display
// Padding(
// padding: const EdgeInsets.symmetric(vertical: 10),
// child: Text(
// DateTime.now().toString(),
// style: const TextStyle(color: Colors.white),
// ),
// ),
// Search Bar // Search Bar
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 10), padding: const EdgeInsets.symmetric(
horizontal: 40,
vertical: 10,
),
child: Container( child: Container(
height: 47, height: 47,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -184,7 +147,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
decoration: const InputDecoration( decoration: const InputDecoration(
border: InputBorder.none, border: InputBorder.none,
hintText: 'Search...', hintText: 'Cari konten...',
hintStyle: TextStyle(color: Colors.grey), hintStyle: TextStyle(color: Colors.grey),
), ),
), ),
@@ -194,7 +157,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
), ),
// Collection Items // Collection Items
SizedBox( Container(
height: 440, height: 440,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@@ -202,7 +165,8 @@ class _PustakaScreenState extends State<PustakaScreen> {
vertical: 60, vertical: 60,
), ),
child: GridView.builder( child: GridView.builder(
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate:
const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 140, maxCrossAxisExtent: 140,
mainAxisSpacing: 20, mainAxisSpacing: 20,
crossAxisSpacing: 20, crossAxisSpacing: 20,
@@ -213,6 +177,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
final item = filteredCollections[index]; final item = filteredCollections[index];
return CollectionContainer( return CollectionContainer(
label: item["label"]!, label: item["label"]!,
lblSize: 11,
imageSvg: item["image"]!, imageSvg: item["image"]!,
width: 30, width: 30,
height: 80, height: 80,
@@ -223,10 +188,7 @@ class _PustakaScreenState extends State<PustakaScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: builder: (_) => const ListEducation(),
(_) => ListEducation(
selectedCategory: item["label"],
),
), ),
); );
}, },
@@ -235,21 +197,21 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
), ),
), ),
// SizedBox( SizedBox(
// child: Padding( child: Padding(
// padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
// horizontal: 5, horizontal: 40,
// vertical: 1, vertical: 1,
// ), ),
// child: Column( child: Column(
// crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
// children: [ children: [
// Text("List Topic", style: TextStyle(color: Colors.black)), Text("Daftar Topik", style: TextStyle(color: Colors.black)),
// Divider(color: Colors.transparent), Divider(color: Colors.transparent),
// ], ],
// ), ),
// ), ),
// ), ),
// Horizontal Scroll List // Horizontal Scroll List
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5), padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
@@ -259,12 +221,10 @@ class _PustakaScreenState extends State<PustakaScreen> {
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
children: children: List.generate(
_genres.map((genre) { 10,
return Padding( (index) => Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 8.0),
horizontal: 8.0,
),
child: Card( child: Card(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
@@ -297,9 +257,10 @@ class _PustakaScreenState extends State<PustakaScreen> {
color: Colors.blueAccent, color: Colors.blueAccent,
), ),
Text( Text(
genre['label'], 'Topik ' + (index + 1).toString(),
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 11,
color: Color.fromARGB(255, 0, 0, 0), color: Color.fromARGB(255, 0, 0, 0),
), ),
), ),
@@ -308,12 +269,14 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
), ),
), ),
);
}).toList(),
), ),
), ),
), ),
), ),
),
),
// Bottom Navigation
// MainMenu(),
], ],
), ),
// BG MEnu // BG MEnu
@@ -328,11 +291,9 @@ class _PustakaScreenState extends State<PustakaScreen> {
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
], ],
), ),
Stack(
children: [
Positioned( Positioned(
bottom: bottomPadding * 98, bottom: 8,
left: (screenWidth - buttonScanSize) / 2, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),
@@ -340,7 +301,6 @@ class _PustakaScreenState extends State<PustakaScreen> {
), ),
], ],
), ),
],
); );
} }
} }
@@ -1,58 +1,34 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freekake/components/bottom_navbar.dart'; import 'package:furibase/components/bottom_navbar.dart';
import 'package:freekake/components/main_menu.dart'; import 'package:furibase/components/main_menu.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:furibase/components/scan_button.dart';
import 'package:image_picker/image_picker.dart'; import 'package:furibase/helpers/pick_image.dart';
import 'dart:io';
// import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show kIsWeb;
class DataSaya extends StatefulWidget { class AkunSaya extends StatefulWidget {
const DataSaya({super.key});
@override @override
_DataSayaState createState() => _DataSayaState(); _AkunSayaState createState() => _AkunSayaState();
} }
class _DataSayaState extends State<DataSaya> { class _AkunSayaState extends State<AkunSaya> {
dynamic _profileImage; dynamic _profileImage;
dynamic _headerImage; dynamic _headerImage;
ImageProvider? imageProvider; //final ImagePicker _picker = ImagePicker();
final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async { Future<void> _pickImage(bool isProfile) async {
if (kIsWeb) { final imagePicker = ImagePickerHelper();
// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes(); dynamic pic = await imagePicker.pickImage();
// if (bytesFromPicker != null) {
// setState(() { if (pic != null) {
// if (isProfile) {
// _profileImage = bytesFromPicker;
// } else {
// _headerImage = bytesFromPicker;
// }
// });
// }
} else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
final imageFile = File(pickedFile.path);
setState(() { setState(() {
if (isProfile) { if (isProfile) {
_profileImage = imageFile; _profileImage = pic;
} else { } else {
_headerImage = imageFile; _headerImage = pic;
} }
imageProvider =
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
}); });
} else {
imageProvider = AssetImage("assets/images/luffy.png");
}
} }
} }
@@ -60,22 +36,23 @@ class _DataSayaState extends State<DataSaya> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text("Data Pribadi"), title: Text("Saya"),
backgroundColor: Color.fromARGB(225, 79, 76, 182), backgroundColor: Color.fromARGB(225, 79, 76, 182),
), ),
resizeToAvoidBottomInset: false,
backgroundColor: const Color.fromARGB(255, 255, 255, 255), backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: Stack( body: Stack(
children: [ children: [
Align( Positioned(
alignment: Alignment.bottomCenter, bottom: 0,
left: 0,
right: 0,
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 0.0, left: 20, right: 20), padding: const EdgeInsets.only(top: 20.0, left: 20, right: 20),
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.7, height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 212, 211, 208), color: const Color.fromARGB(255, 205, 202, 189),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
topRight: Radius.circular(20), topRight: Radius.circular(20),
@@ -86,6 +63,7 @@ class _DataSayaState extends State<DataSaya> {
), ),
Column( Column(
children: [ children: [
// Header image (bisa diubah)
SizedBox( SizedBox(
height: 80, height: 80,
child: Container( child: Container(
@@ -98,7 +76,7 @@ class _DataSayaState extends State<DataSaya> {
), ),
), ),
), ),
SizedBox(height: 70), SizedBox(height: 40),
Expanded( Expanded(
child: Padding( child: Padding(
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
@@ -106,75 +84,48 @@ class _DataSayaState extends State<DataSaya> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40),
children: [ children: [
TextFormField( TextFormField(
initialValue: "Hasan", initialValue: "Cepot",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Nama Siswa', labelText: 'Nama',
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField( TextFormField(
initialValue: "Jawa Barat", initialValue: "cpt09",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Provinsi', labelText: 'Nama Pengguna',
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField( TextFormField(
initialValue: "Bandung", initialValue: "Jl. Sentosa jaya",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Kabupaten', labelText: 'Alamat',
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField( TextFormField(
initialValue: "SDN 1 Bandung Barat", initialValue: "******",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Sekolah', labelText: 'Kata Sandi',
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField( TextFormField(
initialValue: "Laki-laki", initialValue: "+62923",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Jenis Kelamin', labelText: 'No. HP',
labelStyle: TextStyle(color: Colors.black),
),
style: TextStyle(color: Colors.black),
),
TextFormField(
initialValue: "Bandung 13-05-2025",
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Sekolah',
labelStyle: TextStyle(color: Colors.black),
),
style: TextStyle(color: Colors.black),
),
TextFormField(
initialValue: "56 Kg",
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Berat Badan',
labelStyle: TextStyle(color: Colors.black),
),
style: TextStyle(color: Colors.black),
),
TextFormField(
initialValue: "170",
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'Tinggi Badan',
labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
@@ -205,7 +156,7 @@ class _DataSayaState extends State<DataSaya> {
: null, : null,
child: child:
_profileImage == null _profileImage == null
? Image.asset("assets/images/luffy.png") ? Icon(Icons.person, size: 50, color: Colors.white)
: null, : null,
), ),
CircleAvatar( CircleAvatar(
@@ -220,14 +171,14 @@ class _DataSayaState extends State<DataSaya> {
Positioned( Positioned(
top: 130, top: 130,
left: MediaQuery.of(context).size.width / 2 - 30, left: MediaQuery.of(context).size.width / 2 - 50,
child: GestureDetector( child: GestureDetector(
onTap: () => _pickImage(true), onTap: () => _pickImage(true),
child: Stack( child: Stack(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
Text( Text(
"Luffy kun", "Nama Akun",
style: TextStyle( style: TextStyle(
color: Colors.deepPurple, color: Colors.deepPurple,
fontSize: 18, fontSize: 18,
+27 -28
View File
@@ -7,12 +7,9 @@ import 'package:freekake/components/scan_button.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'dart:io'; import 'dart:io';
// import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show kIsWeb;
class AkunSaya extends StatefulWidget { class AkunSaya extends StatefulWidget {
const AkunSaya({super.key});
@override @override
_AkunSayaState createState() => _AkunSayaState(); _AkunSayaState createState() => _AkunSayaState();
} }
@@ -20,8 +17,6 @@ class AkunSaya extends StatefulWidget {
class _AkunSayaState extends State<AkunSaya> { class _AkunSayaState extends State<AkunSaya> {
dynamic _profileImage; dynamic _profileImage;
dynamic _headerImage; dynamic _headerImage;
ImageProvider? imageProvider;
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async { Future<void> _pickImage(bool isProfile) async {
@@ -39,19 +34,13 @@ class _AkunSayaState extends State<AkunSaya> {
} else { } else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery); final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) { if (pickedFile != null) {
final imageFile = File(pickedFile.path);
setState(() { setState(() {
if (isProfile) { if (isProfile) {
_profileImage = imageFile; _profileImage = File(pickedFile.path);
} else { } else {
_headerImage = imageFile; _headerImage = File(pickedFile.path);
} }
imageProvider =
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
}); });
} else {
imageProvider = AssetImage("assets/images/luffy.png");
} }
} }
} }
@@ -75,7 +64,7 @@ class _AkunSayaState extends State<AkunSaya> {
height: MediaQuery.of(context).size.height * 0.7, height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color.fromARGB(255, 212, 211, 208), color: const Color.fromARGB(255, 205, 202, 189),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topLeft: Radius.circular(20),
topRight: Radius.circular(20), topRight: Radius.circular(20),
@@ -107,7 +96,7 @@ class _AkunSayaState extends State<AkunSaya> {
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40), padding: EdgeInsets.symmetric(horizontal: 20, vertical: 40),
children: [ children: [
TextFormField( TextFormField(
initialValue: "Luffy Kun", initialValue: "Cepot",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Nama', labelText: 'Nama',
@@ -116,7 +105,7 @@ class _AkunSayaState extends State<AkunSaya> {
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField( TextFormField(
initialValue: "luffy01", initialValue: "cpt09",
decoration: const InputDecoration( decoration: const InputDecoration(
border: UnderlineInputBorder(), border: UnderlineInputBorder(),
labelText: 'Nama Pengguna', labelText: 'Nama Pengguna',
@@ -125,15 +114,16 @@ class _AkunSayaState extends State<AkunSaya> {
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
// TextFormField( TextFormField(
// initialValue: "Jl. Sentosa jaya", initialValue: "Jl. Sentosa jaya",
// decoration: const InputDecoration( decoration: const InputDecoration(
// border: UnderlineInputBorder(), border: UnderlineInputBorder(),
// labelText: 'Alamat', labelText: 'Alamat',
// labelStyle: TextStyle(color: Colors.black), labelStyle: TextStyle(color: Colors.black),
// ), ),
// style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
// ), ),
TextFormField( TextFormField(
initialValue: "******", initialValue: "******",
decoration: const InputDecoration( decoration: const InputDecoration(
@@ -143,6 +133,15 @@ class _AkunSayaState extends State<AkunSaya> {
), ),
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.black),
), ),
TextFormField(
initialValue: "+62923",
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: 'No. HP',
labelStyle: TextStyle(color: Colors.black),
),
style: TextStyle(color: Colors.black),
),
], ],
), ),
), ),
@@ -169,7 +168,7 @@ class _AkunSayaState extends State<AkunSaya> {
: null, : null,
child: child:
_profileImage == null _profileImage == null
? Image.asset("assets/images/luffy.png") ? Icon(Icons.person, size: 50, color: Colors.white)
: null, : null,
), ),
CircleAvatar( CircleAvatar(
@@ -184,14 +183,14 @@ class _AkunSayaState extends State<AkunSaya> {
Positioned( Positioned(
top: 130, top: 130,
left: MediaQuery.of(context).size.width / 2 - 30, left: MediaQuery.of(context).size.width / 2 - 50,
child: GestureDetector( child: GestureDetector(
onTap: () => _pickImage(true), onTap: () => _pickImage(true),
child: Stack( child: Stack(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
children: [ children: [
Text( Text(
"Luffy kun", "Nama Akun",
style: TextStyle( style: TextStyle(
color: Colors.deepPurple, color: Colors.deepPurple,
fontSize: 18, fontSize: 18,
-305
View File
@@ -1,305 +0,0 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:freekake/components/bottom_navbar.dart';
import 'package:freekake/components/main_menu.dart';
import 'package:freekake/components/point_header.dart';
import 'package:freekake/components/scan_button.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
// import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
class PointSaya extends StatefulWidget {
const PointSaya({super.key});
@override
_PointSayaState createState() => _PointSayaState();
}
class _PointSayaState extends State<PointSaya> {
dynamic _profileImage;
dynamic _headerImage;
ImageProvider? imageProvider;
final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async {
if (kIsWeb) {
// Uint8List? bytesFromPicker = await ImagePickerWeb.getImageAsBytes();
// if (bytesFromPicker != null) {
// setState(() {
// if (isProfile) {
// _profileImage = bytesFromPicker;
// } else {
// _headerImage = bytesFromPicker;
// }
// });
// }
} else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) {
final imageFile = File(pickedFile.path);
setState(() {
if (isProfile) {
_profileImage = imageFile;
} else {
_headerImage = imageFile;
}
imageProvider =
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
});
} else {
imageProvider = AssetImage("assets/images/luffy.png");
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Point Saya"),
backgroundColor: Color.fromARGB(225, 79, 76, 182),
),
resizeToAvoidBottomInset: false,
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(top: 0.0, left: 20, right: 20),
child: Container(
height: MediaQuery.of(context).size.height * 0.7,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: const Color.fromARGB(150, 137, 123, 69),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Column(
spacing: 10,
children: [
SizedBox(height: 4),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
decoration: BoxDecoration(
color: const Color.fromARGB(255, 191, 184, 184),
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(color: Colors.black12, blurRadius: 8),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(height: 5),
Row(
children: [
// Image.asset(
// 'assets/icons/diamond.png',
// width: 24,
// ),
Text(
"Total Point",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(width: 8),
Text(
"300",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
],
),
Row(
children: [
// Image.asset('assets/icons/coin.png', width: 24),
Text(
"Total Koin",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(width: 8),
Text(
"60",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
],
),
SizedBox(height: 5),
],
),
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(padding: EdgeInsets.all(8)),
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Center(
child: Text(
"Riwayat poin dan koin",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white60,
),
),
),
// color: Colors.amber,
),
],
),
PointsHeader(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 40),
Text("Furikake", style: TextStyle(color: Colors.white)),
SizedBox(width: 130),
Text(
"",
// "🔥 Level: ${points.level}",
// style: TextStyle(color: Colors.orangeAccent),
),
Text("100", style: TextStyle(color: Colors.lightBlue)),
SizedBox(width: 60),
Text("20", style: TextStyle(color: Colors.greenAccent)),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 40),
Text("Furikake", style: TextStyle(color: Colors.white)),
SizedBox(width: 130),
Text(
"",
// "🔥 Level: ${points.level}",
// style: TextStyle(color: Colors.orangeAccent),
),
Text("100", style: TextStyle(color: Colors.lightBlue)),
SizedBox(width: 60),
Text("20", style: TextStyle(color: Colors.greenAccent)),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(width: 40),
Text("Furikake", style: TextStyle(color: Colors.white)),
SizedBox(width: 130),
Text(
"",
// "🔥 Level: ${points.level}",
// style: TextStyle(color: Colors.orangeAccent),
),
Text("100", style: TextStyle(color: Colors.lightBlue)),
SizedBox(width: 60),
Text("20", style: TextStyle(color: Colors.greenAccent)),
],
),
],
),
),
),
),
// Profile Picture (bisa diubah)
Positioned(
top: 25,
left: MediaQuery.of(context).size.width / 2 - 50,
child: GestureDetector(
onTap: () => _pickImage(true),
child: Stack(
alignment: Alignment.bottomRight,
children: [
CircleAvatar(
radius: 50,
backgroundColor: Colors.grey[300],
backgroundImage:
_profileImage != null
? (kIsWeb
? MemoryImage(_profileImage) as ImageProvider
: FileImage(_profileImage) as ImageProvider)
: null,
child:
_profileImage == null
? Image.asset("assets/images/luffy.png")
: null,
),
CircleAvatar(
radius: 15,
backgroundColor: Colors.blue,
child: Icon(Icons.edit, color: Colors.white, size: 15),
),
],
),
),
),
Positioned(
top: 130,
left: MediaQuery.of(context).size.width / 2 - 30,
child: GestureDetector(
onTap: () => _pickImage(true),
child: Stack(
alignment: Alignment.bottomRight,
children: [
Text(
"Luffy kun",
style: TextStyle(
color: Colors.deepPurple,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
);
}
Widget _buildListItem(IconData icon, String label, {bool isLogout = false}) {
return ListTile(
leading: Icon(
icon,
color:
isLogout
? const Color.fromARGB(255, 181, 47, 47)
: const Color.fromARGB(255, 255, 255, 255),
),
title: Text(label, style: TextStyle(fontSize: 16, color: Colors.black)),
trailing: Icon(Icons.arrow_forward_ios, size: 16),
onTap: () {},
);
}
}
+4 -6
View File
@@ -2,10 +2,10 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:freekake/components/bottom_navbar.dart'; import 'package:furibase/components/bottom_navbar.dart';
import 'package:freekake/components/main_menu.dart'; import 'package:furibase/components/main_menu.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:furibase/components/scan_button.dart';
import 'package:freekake/screen/saya/akun_saya.dart'; import 'package:furibase/screen/saya/akun_saya.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'dart:io'; import 'dart:io';
@@ -13,8 +13,6 @@ import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show kIsWeb;
class ProfileScreenCopy extends StatefulWidget { class ProfileScreenCopy extends StatefulWidget {
const ProfileScreenCopy({super.key});
@override @override
_ProfileScreenState createState() => _ProfileScreenState(); _ProfileScreenState createState() => _ProfileScreenState();
} }
+15 -53
View File
@@ -1,23 +1,18 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:freekake/components/bottom_navbar.dart'; import 'package:freekake/components/bottom_navbar.dart';
import 'package:freekake/components/main_menu.dart'; import 'package:freekake/components/main_menu.dart';
import 'package:freekake/components/scan_button.dart'; import 'package:freekake/components/scan_button.dart';
import 'package:freekake/components/topbar_container.dart'; import 'package:freekake/components/topbar_container.dart';
import 'package:freekake/screen/saya/akun_saya.dart'; import 'package:freekake/screen/saya/akun_saya.dart';
import 'package:freekake/screen/saya/data_saya.dart';
import 'package:freekake/screen/saya/point_saya.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'dart:io'; import 'dart:io';
// import 'package:image_picker_web/image_picker_web.dart';
import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/foundation.dart' show kIsWeb;
class ProfileScreen extends StatefulWidget { class ProfileScreen extends StatefulWidget {
const ProfileScreen({super.key});
@override @override
_ProfileScreenState createState() => _ProfileScreenState(); _ProfileScreenState createState() => _ProfileScreenState();
} }
@@ -28,7 +23,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
// final ImagePicker _picker = ImagePicker(); // final ImagePicker _picker = ImagePicker();
dynamic _profileImage; dynamic _profileImage;
dynamic _headerImage; dynamic _headerImage;
ImageProvider? imageProvider;
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
Future<void> _pickImage(bool isProfile) async { Future<void> _pickImage(bool isProfile) async {
@@ -46,28 +40,19 @@ class _ProfileScreenState extends State<ProfileScreen> {
} else { } else {
final pickedFile = await _picker.pickImage(source: ImageSource.gallery); final pickedFile = await _picker.pickImage(source: ImageSource.gallery);
if (pickedFile != null) { if (pickedFile != null) {
final imageFile = File(pickedFile.path);
setState(() { setState(() {
if (isProfile) { if (isProfile) {
_profileImage = imageFile; _profileImage = File(pickedFile.path);
} else { } else {
_headerImage = imageFile; _headerImage = File(pickedFile.path);
} }
imageProvider =
kIsWeb ? MemoryImage(_profileImage) : FileImage(_profileImage);
}); });
} else {
imageProvider = AssetImage("assets/images/luffy.png");
} }
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final buttonScanSize = screenWidth * 0.20;
final double bottomPadding = (9000 / screenWidth).clamp(0, 0.2);
return Scaffold( return Scaffold(
backgroundColor: const Color.fromARGB(255, 255, 255, 255), backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: Stack( body: Stack(
@@ -146,8 +131,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
: null, : null,
child: child:
_profileImage == null _profileImage == null
? Image.asset( ? Icon(
"assets/images/luffy.png", Icons.person,
size: 50,
color: Colors.white,
) )
: null, : null,
), ),
@@ -171,16 +158,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
Row( Row(
children: [ children: [
Text( Text(
"Luffy", "Name",
style: TextStyle( style: TextStyle(
color: const Color.fromARGB( color: Colors.blueAccent,
255,
0,
0,
0,
),
fontSize: 16,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
@@ -188,15 +168,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
Row( Row(
children: [ children: [
Text( Text(
"Luffy Kun", "Edit Profile",
style: TextStyle( style: TextStyle(
color: const Color.fromARGB( color: Colors.blueAccent,
255,
0,
0,
0,
),
fontWeight: FontWeight.normal,
), ),
), ),
], ],
@@ -217,24 +191,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: const EdgeInsets.symmetric(horizontal: 25.0), padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Divider(height: 0), child: Divider(height: 0),
), ),
_buildListItem(Icons.person, "Data Diri", () { _buildListItem(Icons.person, "Data Diri", () => {}),
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DataSaya()),
);
}),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0), padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Divider(height: 0), child: Divider(height: 0),
), ),
_buildListItem(Icons.person, "Point Saya", () { _buildListItem(Icons.person, "Point Saya", () => {}),
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PointSaya(),
),
);
}),
Padding( Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 25.0, horizontal: 25.0,
@@ -378,8 +340,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()), Positioned(bottom: 0, left: 0, right: 0, child: MainMenu()),
Positioned( Positioned(
bottom: bottomPadding * 98, bottom: 8,
left: (screenWidth - buttonScanSize) / 2, left: MediaQuery.of(context).size.width / 2 - 38,
child: Transform.translate( child: Transform.translate(
offset: Offset(0, -20), offset: Offset(0, -20),
child: ScanButton(), child: ScanButton(),
-36
View File
@@ -1,36 +0,0 @@
import 'package:dio/dio.dart';
class ApiClient {
final Dio _dio = Dio();
final String _baseUrl = 'https://api.freekake.com/';
ApiClient() {
_dio.options.baseUrl = _baseUrl;
_dio.options.connectTimeout = const Duration(seconds: 5);
_dio.options.receiveTimeout = const Duration(seconds: 3);
_dio.interceptors.add(
InterceptorsWrapper(
onRequest: (options, handler) {
print('REQUEST[${options.method}] => PATH: ${options.path}');
// options.headers['Authorization'] = 'Bearer your_token_here';
return handler.next(options);
},
onResponse: (response, handler) {
print(
'RESPONSE[${response.statusCode}] => PATH: ${response.requestOptions.path}',
);
return handler.next(response);
},
onError: (DioException e, handler) {
print(
'ERROR[${e.response?.statusCode}] => PATH: ${e.requestOptions.path}',
);
return handler.next(e);
},
),
);
}
Dio get dio => _dio;
}
-31
View File
@@ -1,31 +0,0 @@
class PlayerPoints {
int xp;
int gp;
int sp;
int level;
PlayerPoints({
required this.xp,
required this.gp,
required this.sp,
required this.level,
});
void addXP(int value) {
xp += value;
if (xp >= xpToNextLevel()) {
levelUp();
}
}
void addGP(int value) => gp += value;
void addSP(int value) => sp += value;
int xpToNextLevel() => 1000 + (level * 200);
void levelUp() {
level++;
sp++;
xp = 0;
}
}
@@ -6,14 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <desktop_webview_window/desktop_webview_window_plugin.h>
#include <file_selector_linux/file_selector_plugin.h> #include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) desktop_webview_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewWindowPlugin");
desktop_webview_window_plugin_register_with_registrar(desktop_webview_window_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar); file_selector_plugin_register_with_registrar(file_selector_linux_registrar);

Some files were not shown because too many files have changed in this diff Show More