Skip to content

Instantly share code, notes, and snippets.

View app_bar_actions.dart
import 'package:flutter/material.dart';
class Home extends StatelessWidget {
const Home({ Key? key }) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: <Widget>[
View go_router_github_login.dart
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Based on https://codelabs.developers.google.com/codelabs/flutter-github-client#3
// Must provide values for githubClientId, githubClientSecret, githubScopers in
// _AppState per the codelab
import 'dart:io';
View go_router_redirect.dart
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Copied from
// https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/redirection.dart
// https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/shared/data.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
View down_double_tap.dart
import 'package:flutter/material.dart';
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Listener(
onPointerDown: (_) {
print('Pointer Down');
View selectable_button.dart
import 'package:flutter/material.dart';
class SelectableButton extends StatefulWidget {
SelectableButton({
super.key,
required this.selected,
this.style,
required this.onPressed,
required this.child,
View overlapping_icon_button_splash.dart
import 'package:flutter/material.dart';
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
color: Colors.green.withOpacity(0.25),
child: Row(
View toggle_button.dart
import 'package:flutter/material.dart';
class ToggleButton extends TextButton {
ToggleButton({
super.key,
required super.onPressed,
super.onLongPress,
super.onHover,
super.onFocusChange,
super.style,
View const_material_state_property.dart
import 'package:flutter/material.dart';
class _MaterialStatePropertyAll<T> implements MaterialStateProperty<T> {
const _MaterialStatePropertyAll(this.value);
final T value;
@override
T resolve(Set<MaterialState> states) => value;
@HansMuller
HansMuller / split_view_v4.dart
Last active Feb 22, 2022
Prototype SplitView
View split_view_v4.dart
// https://gist.github.com/HansMuller/19f2ea6717863bb48df129273031394c
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
@HansMuller
HansMuller / navigation_bar.0.dart
Last active Feb 15, 2022
flutter/examples/api/lib/material/navigation_bar/navigation_bar.0.dart
View navigation_bar.0.dart
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flutter code sample for NavigationBar with nested Navigator destinations.
import 'package:flutter/material.dart';
class Destination {
const Destination(this.index, this.title, this.icon, this.color);