Skip to content

Instantly share code, notes, and snippets.

Avatar

Seth Ladd sethladd

View GitHub Profile
@sethladd
sethladd / flutter_localized_title.dart
Last active Oct 21, 2020
Flutter example of a localized title
View flutter_localized_title.dart
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Note: I'm not the original author, I'm sharing via Gist to make
// it easy for folks to check it out. Please email
// flutter-dev@googlegroups.com if you have questions about that.
// A simple "rough and ready" example of localizing a Flutter app.
// Spanish and English (locale language codes 'en' and 'es') are
View original.dart
return new SingleChildScrollView(
child: new Container(
margin: const EdgeInsets.all(16.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
View dartdoc_flexbox.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="widgets library API docs, for the Dart programming language.">
<title>widgets library - Dart API</title>
<!-- required because all the links are pseudo-absolute -->
View doc_layout.html
<!doctype html>
<html>
<head>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
@sethladd
sethladd / Original.dart
Last active Jun 3, 2017 — forked from asarazan/Original.dart
Comparing Flutter to what it might look like in Kotlin, Dart.soon, and Dart.wishlist
View Original.dart
class TutorialHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Scafold is a layout for the major material design widgets.
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null,
@sethladd
sethladd / index.html
Last active May 22, 2017
layout with flexbox
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<header>Top Nav</header>
<div class="layout-body">
View after-aspirational.dart
import 'package:flutter/material.dart';
import 'eventdetails/eventdetails.dart';
class SquanchyFlutterApp extends StatelessWidget {
@override
build(context: BuildContext): Widget {
final theme = ThemeData(
primarySwatch: MaterialColor(0XFFE65B77, {
View gist:21490b9a6bf3f8dc81e8ea92cacac28d
var stack = Stack (
key: 1
Image.asset ( // background photo
"assets/texture.jpg"
fit: ImageFit.cover
height: 600.0
)
Positioned ( // headline
View .analysis_options
analyzer:
strong-mode: true
linter:
rules:
- always_declare_return_types
- always_specify_types
- annotate_overrides
- avoid_as
- avoid_empty_else
- avoid_init_to_null
View search_api_example.dart
// Real libraries and modules.
library search;
import 'dart:async' show Future;
import 'package:flutter/http.dart' as http;
// Future (aka Promise), type annotations, and top-level functions!
// And yes, async/await without translators!
Future<List<SearchResult>> fetchResults(String query) async {
// single-quote strings, and string interpolation!
You can’t perform that action at this time.