Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
void main() {
runApp(const ThumbDragApp());
}
class ThumbDragApp extends StatelessWidget {
const ThumbDragApp({ super.key });
// 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.
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
/// Flutter code sample for [ScrollEndNotification].
void main() {
// Allow arbitrary foreground and background elements for ButtonStyle
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Home()));
}
class Home extends StatefulWidget {
const Home({ super.key });
// Allow arbitrary foreground and background elements for ButtonStyle
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Home()));
}
class Home extends StatefulWidget {
const Home({ super.key });
// See "Add Decoration to ButtonStyleButton's styling"
// https://github.com/flutter/flutter/issues/130335#issuecomment-1782727064
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Home()));
}
class Home extends StatefulWidget {
// See Allow arbitrary foreground and background elements for ButtonStyle
// https://github.com/flutter/flutter/issues/139456
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Home()));
}
class Home extends StatefulWidget {
import 'package:flutter/material.dart';
// Occupies the same width as the widest single digit used by AnimatedDigit.
class _PlaceholderDigit extends StatelessWidget {
const _PlaceholderDigit();
@override
Widget build(BuildContext context) {
final TextStyle textStyle = Theme.of(context).textTheme.displayLarge!.copyWith(
fontWeight: FontWeight.w500,
class Adaptation<T> {
const Adaptation();
Type get type => T;
T adapt(ThemeData theme, T defaultValue) => defaultValue;
}
class ThemeData {
factory ThemeData({ Iterable<Adaptation>? adaptations }) {
return ThemeData.raw(
adaptationMap: <Type, Adaptation>{
import 'package:flutter/material.dart';
/// Animated text widget that will animate changes in [temperature] to match
/// the effect on the new thermostats.
class AnimatedTemperatureText extends StatefulWidget {
final int temperature;
final Color textColor;
const AnimatedTemperatureText({
super.key,
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class Item extends StatelessWidget {
const Item({ super.key, required this.title, required this.color });