Skip to content

Instantly share code, notes, and snippets.

View tianhaoz95's full-sized avatar

Tianhao Zhou tianhaoz95

View GitHub Profile
@tianhaoz95
tianhaoz95 / prepare_repository.sh
Created October 8, 2019 05:26
Prepare your repository
git clone https://github.com/tianhaoz95/test-drive-flutter-github-actions.git
cd ./test-drive-flutter-github-actions
flutter channel master
flutter upgrade
@tianhaoz95
tianhaoz95 / .gitpod.yml
Created October 8, 2019 16:36
gitpod config for Flutter development
image:
file: .gitpod.dockerfile
github:
prebuilds:
master: true
branches: false
pullRequests: true
pullRequestsFromForks: false
addCheck: false
addComment: true
@tianhaoz95
tianhaoz95 / prepare_flutter.sh
Created October 10, 2019 23:01
Prepare Flutter development environment
# We are the cool kids dancing on the bleeding edge of technology
flutter channel master
flutter upgrade
# This command checks if everything is good to go
flutter doctor -v
# Go inside your repository. It's also okay to use to level
# Flutter project directory as the repository, but it will
# be more effort to maintain
@tianhaoz95
tianhaoz95 / dummy_bottom_nav_bar.dart
Last active October 10, 2019 23:28
Create a dummy bottom nav bar
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Rock Paper Scissors',
theme: ThemeData(
@tianhaoz95
tianhaoz95 / not_so_dumb_bottom_nav_bar.dart
Last active October 10, 2019 23:32
Dumb bottom nav bar with non-trivial tap event listener
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Rock Paper Scissors',
theme: ThemeData(
@tianhaoz95
tianhaoz95 / stateful_bottom_nav_bar.dart
Created October 10, 2019 23:53
Bottom nav bar that remembers tap state
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Rock Paper Scissors',
theme: ThemeData(
@tianhaoz95
tianhaoz95 / render_bottom_nav_bar_ui_using_state.dart
Last active October 11, 2019 00:04
Bottom nav bar that renders UI using state
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Rock Paper Scissors',
theme: ThemeData(
@tianhaoz95
tianhaoz95 / game_with_bottom_nav_bar.dart
Created October 11, 2019 07:51
Rock paper scissors with bottom navigation bar
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@tianhaoz95
tianhaoz95 / unit_test_and_lint.yml
Created October 12, 2019 06:58
Do Flutter unit test and lint in GitHub Actions
name: Unit test and lint
on: [push, pull_request]
jobs:
lint-and-test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
@tianhaoz95
tianhaoz95 / repo_struct_for_github_actions.txt
Created October 12, 2019 07:03
Repository file structure for GitHub Actions
- repository root
- .github
- ISSUE_TEMPLATE
- PULL_REQUEST_TEMPLATE
- workflows
- action1.yml
- action2.yml
...
- your code