Skip to content

Instantly share code, notes, and snippets.

@anoochit
anoochit / home.dart
Created Mar 11, 2021
adaptive layout with LayoutBuilder
View home.dart
import 'dart:developer';
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
}
View ble_advertrise.ino
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <iostream>
#include <string>
BLEServer* pServer = NULL;
BLECharacteristic* pCharacteristic = NULL;
View leanback_android_tv_flutter.md
  • Add software leanback feature in AndroidManifest
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
  • Add banner icon xhdpi 320x180 px for banner
@anoochit
anoochit / search.dart
Created Jan 26, 2021
simple search NOT recommended
View search.dart
Future<List<String>> searchTrip(String keyword) async {
List<String> docId = [];
var value = await FirebaseFirestore.instance.collection('trips').get();
value.docs.forEach((element) {
var title = element['name'].toString().toLowerCase();
var body = element['body'].toString().toLowerCase();
if (body.contains(keyword)) docId.add(element.id);
if (title.contains(keyword)) docId.add(element.id);
});
return docId;
@anoochit
anoochit / step.txt
Created Jan 3, 2021
flutter raspberry pi build release
View step.txt
STEP 1
------
fultter build bundle
STEP 2
-------
@anoochit
anoochit / main.dart
Last active Dec 3, 2020
login form with clippath
View main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@anoochit
anoochit / main.dart
Created Dec 2, 2020
card view with clip behavior
View main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@anoochit
anoochit / payload_fanpop_response_to_line.txt
Last active Aug 16, 2020
payload_fanpop_response_to_line_server
View payload_fanpop_response_to_line.txt
//--- intent fanpop ---//
[{"type":"text","text":"พบข้อมูล 198 รายการ"},{"type":"template","altText":"this is a confirm template","template":{"type":"confirm","actions":[{"type":"postback","label":"ใช่","data":"action=show_fanpop_page&page=1&total=198"},{"type":"message","label":"ไม่ใช่","text":"เปลี่ยนการค้นหาใหม่"}],"text":"ต้องการแสดงข้อมูล"}}]
//--- result fanpop ---//
[
{"type":"flex","altText":"Flex Message","contents":{"type":"carousel","contents":[{"type":"bubble","direction":"ltr","hero":{"type":"image","url":"https://finfin.vip/sites/default/files/styles/large/public/photo/yiiiwahh/5D57898C-13E0-4F98-ACFF-49D250A39C5D.jpeg","size":"full","aspectRatio":"1:1","aspectMode":"cover"},"body":{"type":"box","layout":"vertical","contents":[{"type":"text","text":"yiiiwahh","size":"xxl","align":"center"},{"type":"text","text":"หญิง, 22 ปี","size":"lg","align":"center"},{"type":"text","text":"1400 บาท","size":"xl","align":"center"}]},"footer":{"type":"box","layout":"vertical","contents":[{"type":"button","ac
@anoochit
anoochit / Dockerfile
Created Jun 16, 2020
Dockerfile to build dart container in small image **ONLY** x86_64 arch
View Dockerfile
FROM google/dart AS dart-runtime
WORKDIR /app
ADD pubspec.* /app/
RUN pub get
ADD bin /app/bin/
RUN pub get --offline
RUN dart2native /app/bin/server.dart -o /app/server
View main.dart
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:pawat/generated/l10n.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.