Skip to content

Instantly share code, notes, and snippets.

View huynguyennovem's full-sized avatar
:shipit:
Build new things

Nguyen Quang Huy huynguyennovem

:shipit:
Build new things
View GitHub Profile
@huynguyennovem
huynguyennovem / socket-server.dart
Created August 27, 2024 15:34
Socket server snippet code
final connectedClients = <WebSocketChannel>[];
return ws.webSocketHandler((WebSocketChannel channel) async {
await channel.ready;
connectedClients.add(channel);
channel.stream.listen((message) {
try {
final receivedMessage = Message.fromJson(json.decode(message));
final updatedMessage = receivedMessage.copyWith(messageState: MessageState.sent);
for (var client in connectedClients) {
import 'package:flutter/material.dart';
const overlaySize = 150.0;
void main() {
runApp(const MaterialApp(home: App()));
}
class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
@huynguyennovem
huynguyennovem / guideline_flutter_gcloud_appengine.md
Last active May 16, 2023 17:18
Flutter & Google App Engine build
@huynguyennovem
huynguyennovem / conditional_parent_widget.md
Created April 24, 2023 16:22
Conditionally rendering widget in Flutter

conditional_parent_widget.dart:

import 'package:flutter/material.dart';

class ConditionalParentWidget extends StatelessWidget {
  final bool condition;
  final Widget Function({Widget? child}) leftParent;
  final Widget Function({Widget? child}) rightParent;
  final Widget child;
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
@huynguyennovem
huynguyennovem / ios_addtoapp_embed_framework_optionA.md
Created March 28, 2023 07:13 — forked from huycozy/addtoapp_ios_embed_cocoapods_optionA.md
[Hands-on] Integrate a Flutter module into your iOS project (Option A)
@huynguyennovem
huynguyennovem / ios_addtoapp_embed_framework.md
Created March 9, 2023 08:19 — forked from huycozy/addtoapp_ios_embed_framework_optionB.md
[Hands-on] Integrate a Flutter module into your iOS project
  1. Add test package to pubspec.yaml
  • Old:
flutter_driver:
  sdk: flutter
  • New:
@huynguyennovem
huynguyennovem / google_codelabs_appscript.gs
Last active November 28, 2022 15:41
Google codelabs tool App script
function doGet(request) {
var sheet = SpreadsheetApp.openById("1bzuFEiI9Sh3fT_nY84b2JdTqzhpVHkU00VKsVhKOr4U");
var values = sheet.getActiveSheet().getDataRange().getValues();
var data = [];
for (var i = 1; i < values.length; i++) {
var row = values[i];
var datas = {};
datas['Timestamp'] = row[0];
datas['Your email'] = row[1];
datas['Joined codelab'] = row[2];
@huynguyennovem
huynguyennovem / flutter_dismissible_datepicker.dart
Created November 22, 2022 07:07
Dismissible date picker in Flutter
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override