国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "net/http/httputil" | |
| "net/url" | |
| "github.com/gin-gonic/gin" | |
| ) |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'How to overlap SliverList on a SliverAppBar', | |
| debugShowCheckedModeBanner: false, |
| void main() async { | |
| WidgetsFlutterBinding.ensureInitialized(); | |
| var databasesPath = await getDatabasesPath(); | |
| var path = join(databasesPath, 'example.db'); | |
| var database = await openDatabase(path, version: 1, onCreate: (db, version) async { | |
| await db.execute('''CREATE TABLE MyTable ( | |
| id INTEGER PRIMARY KEY, | |
| name TEXT)'''); |
| import 'package:flutter/material.dart'; | |
| import 'package:shared_preferences/shared_preferences.dart'; | |
| //https://stackoverflow.com/a/53107519/10409567 | |
| void main() async { | |
| // load the shared preferences from disk before the app is started | |
| WidgetsFlutterBinding.ensureInitialized(); | |
| final prefs = await SharedPreferences.getInstance(); | |
| // create new theme controller, which will get the currently selected from shared preferences |
| import 'package:food_cookbook/repo/food_repo_contract.dart'; | |
| import 'package:path/path.dart'; | |
| import 'package:sqflite/sqflite.dart'; | |
| class DatabaseHelper { | |
| static final DatabaseHelper _instance = DatabaseHelper.internal(); | |
| factory DatabaseHelper() => _instance; | |
| static Database _db; |
| # Luke's config for the Zoomer Shell | |
| # Enable colors and change prompt: | |
| autoload -U colors && colors | |
| PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b " | |
| # History in cache directory: | |
| HISTSIZE=10000 | |
| SAVEHIST=10000 | |
| HISTFILE=~/.cache/zsh/history |
| import 'package:path/path.dart' as path; | |
| class AppUtil{ | |
| static Future<String> getFileNameWithExtension(File file)async{ | |
| if(await file.exists()){ | |
| //To get file name without extension | |
| //path.basenameWithoutExtension(file.path); | |
| import 'package:flutter/material.dart'; | |
| class CustomPage extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: Container(), | |
| floatingActionButton: FloatingActionButton( | |
| onPressed: () { | |
| showModalBottomSheet( |
| var orginalCallback; | |
| void main() { | |
| runApp(...); | |
| orginalCallback = window.onReportTimings; | |
| window.onReportTimings = onReportTimings; | |
| } | |
| const maxframes = 60; | |
| final lastFrames = ListQueue<FrameTiming>(maxframes); |
国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。
Dockerized 实践 https://github.com/y0ngb1n/dockerized