Skip to content

Instantly share code, notes, and snippets.

Tommie N. Carter, Jr., BSIT, MBA mingsai

Block or report user

Report or block mingsai

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mingsai
mingsai / copy_sqlite_to_docs.dart
Last active Dec 14, 2019
Use prepoulated sqlite db in flutter
View copy_sqlite_to_docs.dart
// Create a new file within your document directory
// (Probably want to check whether it already exists first...)
Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "working_data.db");
ByteData data = await rootBundle.load(join("assets", "stored_data.db"));
List<int> bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
await new File(path).writeAsBytes(bytes);
@mingsai
mingsai / sharedpref_stateless.dart
Created Dec 13, 2019
Stateless Widget - Shared Preferences Example
View sharedpref_stateless.dart
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.blue),
@mingsai
mingsai / animated_backgrounds_example.dart
Last active Dec 13, 2019
Animated Backgrounds Example
View animated_backgrounds_example.dart
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:animated_background/animated_background.dart';
import 'package:flutter/services.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@mingsai
mingsai / scaffold_sample.dart
Last active Dec 11, 2019
Scaffold with drawer example
View scaffold_sample.dart
import 'package:flutter/material.dart';
void main()
{
runApp(MaterialApp(
title: 'AndroidMonks',
home: Scaffold(
appBar: AppBar(
title: Text('Androidmonks'),
backgroundColor: Colors.orangeAccent,
@mingsai
mingsai / scaffold_sample.dart
Created Dec 11, 2019
Scaffold with drawer example
View scaffold_sample.dart
import 'package:flutter/material.dart';
void main()
{
runApp(MaterialApp(
title: 'AndroidMonks',
home: Scaffold(
appBar: AppBar(
title: Text('Androidmonks'),
backgroundColor: Colors.orangeAccent,
@mingsai
mingsai / single_multiple_animation_builder.dart
Last active Dec 10, 2019
Single/Multiple Animation Builder
View single_multiple_animation_builder.dart
SingleAnimationBuilder _timeAnimation(int number) {
final duration = Duration(milliseconds: 500);
return SingleAnimationBuilder(
duration: duration,
buildInfo: SingleAnimationBuildInfo(
animatable: Tween<double>(begin: 25, end: 100),
from: Duration.zero,
duration: duration),
buildAnimation: (context, data) {
return Text(
@mingsai
mingsai / clickable_textspan.dart
Created Dec 9, 2019
Clickable TextSpan Behavior (Change text on tap)
View clickable_textspan.dart
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
class MakeStringClickable extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _MakeStringClickableState();
}
}
View swift_learnxinyminutes.swift
// import a module
import Foundation
// Single-line comments are prefixed with //
// Multi-line comments start with /* and end with */
/* Nested multiline comments
/* ARE */
allowed
*/
@mingsai
mingsai / dart_learnxinyminutes.dart
Created Dec 7, 2019
Quick Summary of Dart Language
View dart_learnxinyminutes.dart
import "dart:collection";
import "dart:math" as DM;
// Welcome to Learn Dart in 15 minutes. http://www.dartlang.org/
// This is an executable tutorial. You can run it with Dart or on
// the Try Dart! site if you copy/paste it there. http://try.dartlang.org/
// Function declaration and method declaration look the same. Function
// declarations can be nested. The declaration takes the form of
// name() {} or name() => singleLineExpression;
@mingsai
mingsai / phone_call.dart
Created Dec 7, 2019
Flutter Phone Call Sample
View phone_call.dart
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
home: new Home(),
);
You can’t perform that action at this time.