Skip to content

Instantly share code, notes, and snippets.

View anoochit's full-sized avatar

Anuchit Chalothorn anoochit

View GitHub Profile
@anoochit
anoochit / load_epub_asset.dart
Created July 27, 2024 18:55
Load epub data from assets
Future<EpubController> loadEpub() async {
var asset = await PlatformAssetBundle().load("assets/alice.epub");
return EpubController(
document: EpubDocument.openData(asset.buffer
.asUint8List(asset.offsetInBytes, asset.lengthInBytes)));
}
@override
Widget build(BuildContext context) => FutureBuilder<EpubController>(
future: loadEpub(),
@anoochit
anoochit / main.dart
Created March 27, 2024 08:24
consult radio button
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@anoochit
anoochit / main.dart
Created March 9, 2024 12:36
alert dialog
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
@anoochit
anoochit / main.dart
Created February 13, 2024 07:17
sample color scheme seed
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@anoochit
anoochit / shimmer.dart
Created January 30, 2024 11:13
simmer effect with gidview
GridView.builder(
itemCount: 8,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 4,
crossAxisSpacing: 4,
),
itemBuilder: (context, index) {
return Shimmer.fromColors(
baseColor: Colors.grey.shade200,
@anoochit
anoochit / th-address.json
Created November 20, 2023 11:31 — forked from mennwebs/th-address.json
Thai Address from Postal Code - JSON
This file has been truncated, but you can view the full file.
[
{
"zipCode": "10100",
"subDistrictList": [
{
"subDistrictId": "100801",
"districtId": "1008",
"provinceId": "10",
"subDistrictName": "ป้อมปราบ"
@anoochit
anoochit / home.dart
Created October 31, 2023 05:23
consult bottom navigation
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@anoochit
anoochit / post_items.json
Last active October 5, 2023 16:56
post item example
[
{
"id": 1,
"user": {
"name": "Awesom User",
"avatarUrl": "https://i.pravatar.cc/300"
},
"content": "Hello",
"type": "text",
"datetime": "2023-10-04 22:10:42"
@anoochit
anoochit / Dockerfile
Last active March 31, 2024 22:43
Dockerfile for prisma dart and dart frog
FROM dart:latest as builder
# Install Node.js LTS to builder
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\
apt-get install -y nodejs
# Sets the working directory to /app
WORKDIR /app
# Copies the current directory contents into the container at /app
@anoochit
anoochit / rvm_state.txt
Last active August 23, 2023 01:30
rvm state
เปิดช่อง
----
{ "state":2 , "result": 1}
เช็คน้ำหนัก
----
{ "state":3 , "result": 1}