mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

* Update project.pbxproj files to say Flutter rather than Chromium Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright. * Update the copyright notice checker to require a standard notice on all files * Update copyrights on Dart files. (This was a mechanical commit.) * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine. Some were already marked "The Flutter Authors", not clear why. Their dates have been normalized. Some were missing the blank line after the license. Some were randomly different in trivial ways for no apparent reason (e.g. missing the trailing period). * Clean up the copyrights in non-Dart files. (Manual edits.) Also, make sure templates don't have copyrights. * Fix some more ORGANIZATIONNAMEs
124 lines
3.3 KiB
Dart
124 lines
3.3 KiB
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.
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AnimatedIconsTestApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const MaterialApp(
|
|
title: 'Animated Icons Test',
|
|
home: Scaffold(
|
|
body: IconsList(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class IconsList extends StatelessWidget {
|
|
const IconsList();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView(
|
|
children: samples.map<IconSampleRow>((IconSample s) => IconSampleRow(s)).toList(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class IconSampleRow extends StatefulWidget {
|
|
const IconSampleRow(this.sample);
|
|
|
|
final IconSample sample;
|
|
|
|
@override
|
|
State createState() => IconSampleRowState();
|
|
}
|
|
|
|
class IconSampleRowState extends State<IconSampleRow> with SingleTickerProviderStateMixin {
|
|
AnimationController progress;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListTile(
|
|
leading: InkWell(
|
|
onTap: () { progress.forward(from: 0.0); },
|
|
child: AnimatedIcon(
|
|
icon: widget.sample.icon,
|
|
progress: progress,
|
|
color: Colors.lightBlue,
|
|
),
|
|
),
|
|
title: Text(widget.sample.description),
|
|
subtitle: Slider(
|
|
value: progress.value,
|
|
onChanged: (double v) { progress.animateTo(v, duration: Duration.zero); },
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
progress = AnimationController(vsync: this, duration: const Duration(milliseconds: 300));
|
|
progress.addListener(_handleChange);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
progress.removeListener(_handleChange);
|
|
super.dispose();
|
|
}
|
|
|
|
void _handleChange() {
|
|
setState(() {});
|
|
}
|
|
}
|
|
|
|
const List<IconSample> samples = <IconSample> [
|
|
IconSample(AnimatedIcons.arrow_menu, 'arrow_menu'),
|
|
IconSample(AnimatedIcons.menu_arrow, 'menu_arrow'),
|
|
|
|
IconSample(AnimatedIcons.close_menu, 'close_menu'),
|
|
IconSample(AnimatedIcons.menu_close, 'menu_close'),
|
|
|
|
IconSample(AnimatedIcons.home_menu, 'home_menu'),
|
|
IconSample(AnimatedIcons.menu_home, 'menu_home'),
|
|
|
|
IconSample(AnimatedIcons.play_pause, 'play_pause'),
|
|
IconSample(AnimatedIcons.pause_play, 'pause_play'),
|
|
|
|
IconSample(AnimatedIcons.list_view, 'list_view'),
|
|
IconSample(AnimatedIcons.view_list, 'view_list'),
|
|
|
|
IconSample(AnimatedIcons.add_event, 'add_event'),
|
|
IconSample(AnimatedIcons.event_add, 'event_add'),
|
|
|
|
IconSample(AnimatedIcons.ellipsis_search, 'ellipsis_search'),
|
|
IconSample(AnimatedIcons.search_ellipsis, 'search_ellipsis'),
|
|
];
|
|
|
|
class IconSample {
|
|
const IconSample(this.icon, this.description);
|
|
final AnimatedIconData icon;
|
|
final String description;
|
|
}
|
|
|
|
// Sets a platform override for desktop to avoid exceptions. See
|
|
// https://flutter.dev/desktop#target-platform-override for more info.
|
|
// TODO(gspencergoog): Remove once TargetPlatform includes all desktop platforms.
|
|
void _enablePlatformOverrideForDesktop() {
|
|
if (!kIsWeb && (Platform.isWindows || Platform.isLinux)) {
|
|
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
_enablePlatformOverrideForDesktop();
|
|
runApp(AnimatedIconsTestApp());
|
|
}
|