mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Beta (#1234)
This commit is contained in:
@@ -11,6 +11,8 @@ import 'common.dart';
|
||||
void main() async {
|
||||
final packageDirs = listPackageDirs(Directory.current)
|
||||
.map((path) => p.relative(path, from: Directory.current.path))
|
||||
// TODO: remove this when `slide_puzzle` is removed from samples repo
|
||||
.where((path) => !path.contains('slide_puzzle'))
|
||||
.toList();
|
||||
|
||||
print('Package dirs:\n${packageDirs.map((path) => ' $path').join('\n')}');
|
||||
|
||||
@@ -130,7 +130,7 @@ class SelectionUserManagedState extends State<SelectionUserManaged> {
|
||||
onPressed: _handleClearSelection, child: const Text('Clear Selection'));
|
||||
|
||||
return Column(
|
||||
children: [SizedBox(child: chart, height: 150.0), clearSelection]);
|
||||
children: [SizedBox(height: 150.0, child: chart), clearSelection]);
|
||||
}
|
||||
|
||||
void _infoSelectionModelUpdated(charts.SelectionModel<String> model) {
|
||||
|
||||
@@ -118,7 +118,7 @@ class _SliderCallbackState extends State<SliderLine> {
|
||||
});
|
||||
}
|
||||
|
||||
SchedulerBinding.instance!.addPostFrameCallback(rebuild);
|
||||
SchedulerBinding.instance.addPostFrameCallback(rebuild);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -43,7 +43,7 @@ class GalleryScaffold extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_GalleryScaffoldState createState() => _GalleryScaffoldState();
|
||||
State<GalleryScaffold> createState() => _GalleryScaffoldState();
|
||||
}
|
||||
|
||||
class _GalleryScaffoldState extends State<GalleryScaffold> {
|
||||
@@ -61,7 +61,7 @@ class _GalleryScaffoldState extends State<GalleryScaffold> {
|
||||
SizedBox(height: 250.0, child: widget.childBuilder()),
|
||||
])),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.refresh), onPressed: _handleButtonPress),
|
||||
onPressed: _handleButtonPress, child: const Icon(Icons.refresh)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ class GalleryApp extends StatefulWidget {
|
||||
const GalleryApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
GalleryAppState createState() => GalleryAppState();
|
||||
State<GalleryApp> createState() => _GalleryAppState();
|
||||
}
|
||||
|
||||
/// The main gallery app state.
|
||||
///
|
||||
/// Controls performance overlay, and instantiates a [Home] widget.
|
||||
class GalleryAppState extends State<GalleryApp> {
|
||||
class _GalleryAppState extends State<GalleryApp> {
|
||||
// Initialize app settings from the default configuration.
|
||||
bool _showPerformanceOverlay = defaultConfig.showPerformanceOverlay;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -61,7 +61,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -103,5 +103,5 @@ packages:
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
flutter: ">=2.5.0"
|
||||
|
||||
@@ -3,7 +3,7 @@ description: Charts-Flutter Demo
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -12,8 +12,8 @@ dependencies:
|
||||
meta: ^1.1.1
|
||||
intl: ^0.17.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.4
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
1
web/game_template
Symbolic link
1
web/game_template
Symbolic link
@@ -0,0 +1 @@
|
||||
../game_template
|
||||
@@ -17,12 +17,12 @@ class LayeredChart extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return LayeredChartState();
|
||||
State<LayeredChart> createState() {
|
||||
return _LayeredChartState();
|
||||
}
|
||||
}
|
||||
|
||||
class LayeredChartState extends State<LayeredChart> {
|
||||
class _LayeredChartState extends State<LayeredChart> {
|
||||
late List<Path> paths;
|
||||
late List<Path> capPaths;
|
||||
late List<double> maxValues;
|
||||
@@ -167,13 +167,13 @@ class LayeredChartState extends State<LayeredChart> {
|
||||
return Container(
|
||||
color: Constants.backgroundColor,
|
||||
child: CustomPaint(
|
||||
foregroundPainter: ChartPainter(this, widget.dataToPlot,
|
||||
foregroundPainter: _ChartPainter(this, widget.dataToPlot,
|
||||
widget.milestones, 80, 50, 50, 12, 500, widget.animationValue),
|
||||
child: Container()));
|
||||
}
|
||||
}
|
||||
|
||||
class ChartPainter extends CustomPainter {
|
||||
class _ChartPainter extends CustomPainter {
|
||||
static List<Color?> colors = [
|
||||
Colors.red[900],
|
||||
const Color(0xffc4721a),
|
||||
@@ -208,9 +208,9 @@ class ChartPainter extends CustomPainter {
|
||||
late Paint linePaint;
|
||||
late Paint fillPaint;
|
||||
|
||||
LayeredChartState state;
|
||||
_LayeredChartState state;
|
||||
|
||||
ChartPainter(
|
||||
_ChartPainter(
|
||||
this.state,
|
||||
this.dataToPlot,
|
||||
this.milestones,
|
||||
|
||||
@@ -22,7 +22,7 @@ class MainLayout extends StatefulWidget {
|
||||
const MainLayout({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MainLayoutState createState() => _MainLayoutState();
|
||||
State<MainLayout> createState() => _MainLayoutState();
|
||||
}
|
||||
|
||||
class _MainLayoutState extends State<MainLayout> with TickerProviderStateMixin {
|
||||
|
||||
@@ -29,12 +29,12 @@ class Timeline extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return TimelineState();
|
||||
State<Timeline> createState() {
|
||||
return _TimelineState();
|
||||
}
|
||||
}
|
||||
|
||||
class TimelineState extends State<Timeline> {
|
||||
class _TimelineState extends State<Timeline> {
|
||||
HashMap<String, TextPainter> labelPainters = HashMap();
|
||||
|
||||
@override
|
||||
@@ -49,7 +49,7 @@ class TimelineState extends State<Timeline> {
|
||||
for (var weekLabel in widget.weekLabels) {
|
||||
labelPainters[weekLabel.label] =
|
||||
_makeTextPainter(Constants.milestoneTimelineColor, weekLabel.label);
|
||||
labelPainters[weekLabel.label + '_red'] =
|
||||
labelPainters['${weekLabel.label}_red'] =
|
||||
_makeTextPainter(Colors.redAccent, weekLabel.label);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class TimelineState extends State<Timeline> {
|
||||
}
|
||||
},
|
||||
child: CustomPaint(
|
||||
foregroundPainter: TimelinePainter(
|
||||
foregroundPainter: _TimelinePainter(
|
||||
this, widget.numWeeks, widget.animationValue, widget.weekLabels),
|
||||
child: Container(
|
||||
height: 200,
|
||||
@@ -106,8 +106,8 @@ class TimelineState extends State<Timeline> {
|
||||
}
|
||||
}
|
||||
|
||||
class TimelinePainter extends CustomPainter {
|
||||
TimelineState state;
|
||||
class _TimelinePainter extends CustomPainter {
|
||||
_TimelineState state;
|
||||
|
||||
late Paint mainLinePaint;
|
||||
late Paint milestoneLinePaint;
|
||||
@@ -123,7 +123,7 @@ class TimelinePainter extends CustomPainter {
|
||||
|
||||
int yearNumber = 2015;
|
||||
|
||||
TimelinePainter(
|
||||
_TimelinePainter(
|
||||
this.state, this.numWeeks, this.animationValue, this.weekLabels) {
|
||||
mainLinePaint = Paint();
|
||||
mainLinePaint.style = PaintingStyle.stroke;
|
||||
|
||||
@@ -47,7 +47,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -75,7 +75,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -138,4 +138,4 @@ packages:
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: github_dataviz
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -10,7 +10,7 @@ dependencies:
|
||||
http: ^0.13.4
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
assets:
|
||||
|
||||
@@ -39,7 +39,7 @@ class Particles extends StatefulWidget {
|
||||
const Particles(this.numberOfParticles, {key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ParticlesState createState() => _ParticlesState();
|
||||
State<Particles> createState() => _ParticlesState();
|
||||
}
|
||||
|
||||
class _ParticlesState extends State<Particles> {
|
||||
|
||||
@@ -36,7 +36,7 @@ class Rendering extends StatefulWidget {
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_RenderingState createState() => _RenderingState();
|
||||
State<Rendering> createState() => _RenderingState();
|
||||
}
|
||||
|
||||
class _RenderingState extends State<Rendering>
|
||||
@@ -199,7 +199,7 @@ class MultiTrackTween extends Animatable<Map<String, dynamic>> {
|
||||
/// Single property to tween. Used by [MultiTrackTween].
|
||||
class Track<T> {
|
||||
final String name;
|
||||
final List<_TrackItem> items = [];
|
||||
final List<TrackItem> items = [];
|
||||
|
||||
Track(this.name);
|
||||
|
||||
@@ -211,20 +211,20 @@ class Track<T> {
|
||||
/// Optionally you can set a named parameter [curve] that applies an easing
|
||||
/// curve to the tween.
|
||||
Track<T> add(Duration duration, Animatable<T> tween, {Curve? curve}) {
|
||||
items.add(_TrackItem(duration, tween, curve: curve));
|
||||
items.add(TrackItem(duration, tween, curve: curve));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
class _TrackItem<T> {
|
||||
class TrackItem<T> {
|
||||
final Duration duration;
|
||||
late Animatable<T> tween;
|
||||
|
||||
_TrackItem(this.duration, Animatable<T> _tween, {Curve? curve}) {
|
||||
TrackItem(this.duration, Animatable<T> tween, {Curve? curve}) {
|
||||
if (curve != null) {
|
||||
tween = _tween.chain(CurveTween(curve: curve));
|
||||
this.tween = tween.chain(CurveTween(curve: curve));
|
||||
} else {
|
||||
tween = _tween;
|
||||
this.tween = tween;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,7 +336,7 @@ class ControlledAnimation<T> extends StatefulWidget {
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
_ControlledAnimationState<T> createState() => _ControlledAnimationState<T>();
|
||||
State<ControlledAnimation> createState() => _ControlledAnimationState<T>();
|
||||
}
|
||||
|
||||
class _ControlledAnimationState<T> extends State<ControlledAnimation>
|
||||
|
||||
@@ -26,14 +26,14 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -61,4 +61,4 @@ packages:
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
|
||||
@@ -3,12 +3,12 @@ description: Example for the simple_animations package
|
||||
homepage: https://github.com/felixblaschke/simple_animations
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_lints: ^2.0.1
|
||||
flutter:
|
||||
assets:
|
||||
- preview.png
|
||||
|
||||
@@ -492,6 +492,10 @@ samples:
|
||||
platforms: ['windows', 'macos', 'linux']
|
||||
type: sample
|
||||
|
||||
###################
|
||||
#### Web Demos ####
|
||||
###################
|
||||
|
||||
- name: Rich Text Editor
|
||||
author: Flutter
|
||||
screenshots:
|
||||
@@ -511,7 +515,8 @@ samples:
|
||||
links: []
|
||||
tags: ["demo", "text"]
|
||||
platforms: ["ios", "android", "web", "windows", "macos", "linux"]
|
||||
type: sample
|
||||
type: demo
|
||||
web: web/simplistic_editor
|
||||
|
||||
- name: Material You
|
||||
author: Flutter
|
||||
@@ -541,13 +546,42 @@ samples:
|
||||
- AppBar
|
||||
packages: []
|
||||
links: []
|
||||
tags: ["Material", "Material You"]
|
||||
tags: ["material", "material you"]
|
||||
platforms: ["ios", "android", "web", "windows", "macos", "linux"]
|
||||
type: sample
|
||||
|
||||
###################
|
||||
#### Web Demos ####
|
||||
###################
|
||||
type: demo
|
||||
web: web/material_3_demo
|
||||
|
||||
- name: Game Template
|
||||
author: Flutter
|
||||
screenshots:
|
||||
- url: images/loading_screen.png
|
||||
alt: Loading screen
|
||||
- url: images/level_selector.png
|
||||
alt: Level selection screen
|
||||
source: https://github.com/flutter/samples/tree/master/game_template
|
||||
description: >
|
||||
This is a game template that shows how to build much of the dressing
|
||||
around an actual game. The game itself is very simple - the value in this
|
||||
sample is everything around the game.
|
||||
difficulty: beginner
|
||||
widgets:
|
||||
- GoRouter
|
||||
- AppLifecycleObserver
|
||||
packages:
|
||||
- audioplayers
|
||||
- firebase_crashlytics
|
||||
- games_services
|
||||
- go_router
|
||||
- google_mobile_ads
|
||||
- in_app_purchase
|
||||
- logging
|
||||
- provider
|
||||
- shared_preferences
|
||||
links: []
|
||||
tags: ["games", "firebase", "ads", "crashlytics", "routing"]
|
||||
platforms: ["ios", "android", "web", "windows", "macos", "linux"]
|
||||
type: demo
|
||||
web: web/material_3_demo
|
||||
|
||||
- name: Charts
|
||||
author: Flutter
|
||||
|
||||
BIN
web/samples_index/web/images/level_selector.png
Normal file
BIN
web/samples_index/web/images/level_selector.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
web/samples_index/web/images/loading_screen.png
Normal file
BIN
web/samples_index/web/images/loading_screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
Reference in New Issue
Block a user