[cleanup] remove unused sysui_widgets
Removes the unused sysui_widgets package.
Moved the time_stringer.dart file into the
userpicker_base_shell as it was the only file being
used and was only used in that location.
TEST=
- fx set x64 --packages topaz/packages/buildbot
- fx full-build
Change-Id: I4a00838887fca30acc6e35ca5343a45747f835b1
diff --git a/bin/userpicker_base_shell/BUILD.gn b/bin/userpicker_base_shell/BUILD.gn
index b057a8a..5a8004b 100644
--- a/bin/userpicker_base_shell/BUILD.gn
+++ b/bin/userpicker_base_shell/BUILD.gn
@@ -40,6 +40,7 @@
"authentication_ui_context_impl.dart",
"circular_button.dart",
"clock.dart",
+ "time_stringer.dart",
"user_list.dart",
"user_picker_base_shell_model.dart",
"user_picker_base_shell_screen.dart",
@@ -62,6 +63,5 @@
"//topaz/public/dart/widgets:lib.widgets",
"//topaz/public/lib/app/dart",
"//topaz/public/lib/ui/flutter",
- "//topaz/shell/widgets",
]
}
diff --git a/bin/userpicker_base_shell/lib/clock.dart b/bin/userpicker_base_shell/lib/clock.dart
index 5187ee7..ed7e932 100644
--- a/bin/userpicker_base_shell/lib/clock.dart
+++ b/bin/userpicker_base_shell/lib/clock.dart
@@ -5,7 +5,8 @@
import 'dart:math';
import 'package:flutter/material.dart';
-import 'package:sysui_widgets/time_stringer.dart';
+
+import 'time_stringer.dart';
/// System Clock in the Base Shell
class Clock extends StatelessWidget {
diff --git a/shell/widgets/lib/time_stringer.dart b/bin/userpicker_base_shell/lib/time_stringer.dart
similarity index 100%
rename from shell/widgets/lib/time_stringer.dart
rename to bin/userpicker_base_shell/lib/time_stringer.dart
diff --git a/lib/base_shell/BUILD.gn b/lib/base_shell/BUILD.gn
index 887dcf8..acd0aa6 100644
--- a/lib/base_shell/BUILD.gn
+++ b/lib/base_shell/BUILD.gn
@@ -27,7 +27,6 @@
"//topaz/public/dart/widgets:lib.widgets",
"//topaz/public/lib/app/dart",
"//topaz/public/lib/ui/flutter",
- "//topaz/shell/widgets",
"//zircon/public/fidl/fuchsia-net:fuchsia-net",
]
}
diff --git a/shell/keyboard/BUILD.gn b/shell/keyboard/BUILD.gn
index 5e5eb47..7c30859 100644
--- a/shell/keyboard/BUILD.gn
+++ b/shell/keyboard/BUILD.gn
@@ -17,7 +17,6 @@
deps = [
"//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/shell/widgets",
]
}
diff --git a/shell/widgets/BUILD.gn b/shell/widgets/BUILD.gn
deleted file mode 100644
index 9fbf588..0000000
--- a/shell/widgets/BUILD.gn
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2016 The Fuchsia 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("//build/dart/dart_library.gni")
-
-dart_library("widgets") {
- package_name = "sysui_widgets"
-
- sources = [
- "default_bundle.dart",
- "icon_slider.dart",
- "key_mappings.dart",
- "three_column_aligned_layout_delegate.dart",
- "time_stringer.dart",
- ]
-
- deps = [
- "//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/public/dart/widgets:lib.widgets",
- ]
-}
diff --git a/shell/widgets/analysis_options.yaml b/shell/widgets/analysis_options.yaml
deleted file mode 100644
index 4adf677..0000000
--- a/shell/widgets/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../../topaz/shell/analysis_options.yaml
diff --git a/shell/widgets/lib/default_bundle.dart b/shell/widgets/lib/default_bundle.dart
deleted file mode 100644
index 7503a62..0000000
--- a/shell/widgets/lib/default_bundle.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Fuchsia 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/services.dart';
-
-AssetBundle _initBundle() {
- if (rootBundle != null) {
- return rootBundle;
- }
- return new NetworkAssetBundle(Uri.base);
-}
-
-/// Returns the default [AssetBundle] for this flutter app.
-final AssetBundle defaultBundle = _initBundle();
diff --git a/shell/widgets/lib/icon_slider.dart b/shell/widgets/lib/icon_slider.dart
deleted file mode 100644
index 9fc90d1..0000000
--- a/shell/widgets/lib/icon_slider.dart
+++ /dev/null
@@ -1,631 +0,0 @@
-// Copyright 2015 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.
-
-import 'dart:math' as math;
-
-import 'package:flutter/gestures.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:flutter/widgets.dart';
-import 'package:meta/meta.dart';
-
-/// A material design slider.
-/// Adapted from Flutter's Slider class. Adds the ability to set an image
-/// for the slider control.
-///
-/// TODO(mikejurka): Merge these changes into Flutter's slider class
-/// This code is almost identical to that class except for the paint method,
-/// and the "thumbImage" parameter.
-///
-/// Used to select from a range of values.
-///
-/// A slider can be used to select from either a continuous or a discrete set of
-/// values. The default is use a continuous range of values from [min] to [max].
-/// To use discrete values, use a non-null value for [divisions], which
-/// indicates the number of discrete intervals. For example, if [min] is 0.0 and
-/// [max] is 50.0 and [divisions] is 5, then the slider can take on the values
-/// discrete values 0.0, 10.0, 20.0, 30.0, 40.0, and 50.0.
-///
-/// The slider itself does not maintain any state. Instead, when the state of
-/// the slider changes, the widget calls the [onChanged] callback. Most widgets
-/// that use a slider will listen for the [onChanged] callback and rebuild the
-/// slider with a new [value] to update the visual appearance of the slider.
-///
-/// Requires one of its ancestors to be a [Material] widget.
-///
-/// See also:
-///
-/// * [Radio]
-/// * [Switch]
-/// * <https://www.google.com/design/spec/components/sliders.html>
-///
-class IconSlider extends StatefulWidget {
- /// Creates a material design slider with an icon for the picker.
- ///
- /// The slider itself does not maintain any state. Instead, when the state of
- /// the slider changes, the widget calls the [onChanged] callback. Most widgets
- /// that use a slider will listen for the [onChanged] callback and rebuild the
- /// slider with a new [value] to update the visual appearance of the slider.
- ///
- /// * [value] determines currently selected value for this slider.
- /// * [onChanged] is called when the user selects a new value for the slider.
- const IconSlider({
- @required this.value,
- @required this.onChanged,
- Key key,
- this.min = 0.0,
- this.max = 1.0,
- this.divisions,
- this.label,
- this.activeColor,
- this.thumbImage,
- }) : assert(value != null),
- assert(min != null),
- assert(max != null),
- assert(value >= min && value <= max),
- assert(divisions == null || divisions > 0),
- super(key: key);
-
- /// The currently selected value for this slider.
- ///
- /// The slider's thumb is drawn at a position that corresponds to this value.
- final double value;
-
- /// Called when the user selects a new value for the slider.
- ///
- /// The slider passes the new value to the callback but does not actually
- /// change state until the parent widget rebuilds the slider with the new
- /// value.
- ///
- /// If null, the slider will be displayed as disabled.
- final ValueChanged<double> onChanged;
-
- /// The minium value the user can select.
- ///
- /// Defaults to 0.0.
- final double min;
-
- /// The maximum value the user can select.
- ///
- /// Defaults to 1.0.
- final double max;
-
- /// The number of discrete divisions.
- ///
- /// Typically used with [label] to show the current discrete value.
- ///
- /// If null, the slider is continuous.
- final int divisions;
-
- /// A label to show above the slider when the slider is active.
- ///
- /// Typically used to display the value of a discrete slider.
- final String label;
-
- /// The color to use for the portion of the slider that has been selected.
- ///
- /// Defaults to accent color of the current [Theme].
- final Color activeColor;
-
- /// Draw this image inside the thumb (i.e. the draggable circle)
- ///
- /// If null, do not draw any image.
- final ImageProvider thumbImage;
-
- @override
- _IconSliderState createState() => new _IconSliderState();
-}
-
-class _IconSliderState extends State<IconSlider> with TickerProviderStateMixin {
- void _handleChanged(double value) {
- assert(widget.onChanged != null);
- widget.onChanged(value * (widget.max - widget.min) + widget.min);
- }
-
- @override
- Widget build(BuildContext context) {
- ThemeData theme = Theme.of(context);
- return new _IconSliderRenderObjectWidget(
- value: (widget.value - widget.min) / (widget.max - widget.min),
- divisions: widget.divisions,
- label: widget.label,
- activeColor: widget.activeColor ?? theme.accentColor,
- textTheme: theme.primaryTextTheme,
- thumbImage: widget.thumbImage,
- configuration: createLocalImageConfiguration(context),
- onChanged: widget.onChanged != null ? _handleChanged : null,
- vsync: this);
- }
-}
-
-class _IconSliderRenderObjectWidget extends LeafRenderObjectWidget {
- const _IconSliderRenderObjectWidget(
- {Key key,
- this.value,
- this.divisions,
- this.label,
- this.activeColor,
- this.textTheme,
- this.thumbImage,
- this.configuration,
- this.onChanged,
- this.vsync})
- : super(key: key);
-
- final double value;
- final int divisions;
- final String label;
- final Color activeColor;
- final TextTheme textTheme;
- final ImageProvider thumbImage;
- final ImageConfiguration configuration;
- final ValueChanged<double> onChanged;
- final TickerProvider vsync;
-
- @override
- _RenderIconSlider createRenderObject(BuildContext context) =>
- new _RenderIconSlider(
- value: value,
- divisions: divisions,
- label: label,
- activeColor: activeColor,
- textTheme: textTheme,
- thumbImage: thumbImage,
- configuration: configuration,
- onChanged: onChanged,
- vsync: vsync,
- );
-
- @override
- void updateRenderObject(
- BuildContext context, _RenderIconSlider renderObject) {
- renderObject
- ..value = value
- ..divisions = divisions
- ..label = label
- ..activeColor = activeColor
- ..textTheme = textTheme
- ..thumbImage = thumbImage
- ..configuration = configuration
- ..onChanged = onChanged;
- // Ticker provider cannot change since there's a 1:1 relationship between
- // the _SliderRenderObjectWidget object and the _SliderState object.
- }
-}
-
-const double _kThumbRadius = 6.0;
-const double _kActiveThumbRadius = 9.0;
-const double _kDisabledThumbRadius = 4.0;
-const double _kReactionRadius = 16.0;
-const double _kTrackWidth = 144.0;
-final Color _kInactiveTrackColor = Colors.grey[400];
-final Color _kActiveTrackColor = Colors.grey[500];
-final Tween<double> _kReactionRadiusTween =
- new Tween<double>(begin: _kThumbRadius, end: _kReactionRadius);
-final Tween<double> _kThumbRadiusTween =
- new Tween<double>(begin: _kThumbRadius, end: _kActiveThumbRadius);
-final ColorTween _kTrackColorTween =
- new ColorTween(begin: _kInactiveTrackColor, end: _kActiveTrackColor);
-final ColorTween _kTickColorTween =
- new ColorTween(begin: Colors.transparent, end: Colors.black54);
-const Duration _kDiscreteTransitionDuration = const Duration(milliseconds: 500);
-
-const double _kLabelBalloonRadius = 14.0;
-final Tween<double> _kLabelBalloonCenterTween =
- new Tween<double>(begin: 0.0, end: -_kLabelBalloonRadius * 2.0);
-final Tween<double> _kLabelBalloonRadiusTween =
- new Tween<double>(begin: _kThumbRadius, end: _kLabelBalloonRadius);
-final Tween<double> _kLabelBalloonTipTween =
- new Tween<double>(begin: 0.0, end: -8.0);
-final double _kLabelBalloonTipAttachmentRatio = math.sin(math.pi / 4.0);
-
-const double _kAdjustmentUnit =
- 0.1; // Matches iOS implementation of material slider.
-
-double _getAdditionalHeightForLabel(String label) {
- return label == null ? 0.0 : _kLabelBalloonRadius * 2.0;
-}
-
-BoxConstraints _getAdditionalConstraints(String label) {
- return new BoxConstraints.tightFor(
- width: _kTrackWidth + 2 * _kReactionRadius,
- height: 2 * _kReactionRadius + _getAdditionalHeightForLabel(label));
-}
-
-class _RenderIconSlider extends RenderConstrainedBox {
- _RenderIconSlider({
- @required double value,
- int divisions,
- String label,
- Color activeColor,
- TextTheme textTheme,
- ImageProvider thumbImage,
- ImageConfiguration configuration,
- this.onChanged,
- TickerProvider vsync,
- }) : _value = value,
- _divisions = divisions,
- _activeColor = activeColor,
- _textTheme = textTheme,
- _thumbImage = thumbImage,
- _configuration = configuration,
- assert(value != null && value >= 0.0 && value <= 1.0),
- super(additionalConstraints: _getAdditionalConstraints(label)) {
- this.label = label;
- _drag = new HorizontalDragGestureRecognizer()
- ..onStart = _handleDragStart
- ..onUpdate = _handleDragUpdate
- ..onEnd = _handleDragEnd;
- _reactionController = new AnimationController(
- duration: kRadialReactionDuration,
- vsync: vsync,
- );
- _reaction = new CurvedAnimation(
- parent: _reactionController, curve: Curves.fastOutSlowIn)
- ..addListener(markNeedsPaint);
- _position = new AnimationController(
- value: value, duration: _kDiscreteTransitionDuration, vsync: vsync)
- ..addListener(markNeedsPaint);
- }
-
- double get value => _value;
- double _value;
- set value(double newValue) {
- assert(newValue != null && newValue >= 0.0 && newValue <= 1.0);
- if (newValue == _value) {
- return;
- }
- _value = newValue;
- if (divisions != null)
- _position.animateTo(newValue, curve: Curves.fastOutSlowIn);
- else
- _position.value = newValue;
- }
-
- int get divisions => _divisions;
- int _divisions;
- set divisions(int newDivisions) {
- if (newDivisions == _divisions) {
- return;
- }
- _divisions = newDivisions;
- markNeedsPaint();
- }
-
- String get label => _label;
- String _label;
- set label(String newLabel) {
- if (newLabel == _label) {
- return;
- }
- _label = newLabel;
- additionalConstraints = _getAdditionalConstraints(_label);
- if (newLabel != null) {
- _labelPainter
- ..text = new TextSpan(
- style: _textTheme.body1.copyWith(fontSize: 10.0),
- text: newLabel,
- )
- ..layout();
- } else {
- _labelPainter.text = null;
- }
- markNeedsPaint();
- }
-
- TextTheme get textTheme => _textTheme;
- TextTheme _textTheme;
- set textTheme(TextTheme value) {
- if (value == _textTheme) {
- return;
- }
- _textTheme = value;
- markNeedsPaint();
- }
-
- Color get activeColor => _activeColor;
- Color _activeColor;
- set activeColor(Color value) {
- if (value == _activeColor) {
- return;
- }
- _activeColor = value;
- markNeedsPaint();
- }
-
- ImageProvider get thumbImage => _thumbImage;
- ImageProvider _thumbImage;
- set thumbImage(ImageProvider value) {
- if (value == _thumbImage) {
- return;
- }
- _thumbImage = value;
- markNeedsPaint();
- }
-
- ImageConfiguration get configuration => _configuration;
- ImageConfiguration _configuration;
- set configuration(ImageConfiguration value) {
- assert(value != null);
- if (value == _configuration) {
- return;
- }
- _configuration = value;
- markNeedsPaint();
- }
-
- @override
- void detach() {
- _cachedThumbPainter?.dispose();
- _cachedThumbPainter = null;
- super.detach();
- }
-
- ValueChanged<double> onChanged;
-
- double get _trackLength => size.width - 2.0 * _kReactionRadius;
-
- Animation<double> _reaction;
- AnimationController _reactionController;
-
- AnimationController _position;
- final TextPainter _labelPainter = new TextPainter();
-
- HorizontalDragGestureRecognizer _drag;
- bool _active = false;
- double _currentDragValue = 0.0;
-
- double get _discretizedCurrentDragValue {
- double dragValue = _currentDragValue.clamp(0.0, 1.0);
- if (divisions != null)
- dragValue = (dragValue * divisions).round() / divisions;
- return dragValue;
- }
-
- bool get isInteractive => onChanged != null;
-
- void _handleDragStart(DragStartDetails details) {
- if (isInteractive) {
- _active = true;
- _currentDragValue =
- (globalToLocal(details.globalPosition).dx - _kReactionRadius) /
- _trackLength;
- onChanged(_discretizedCurrentDragValue);
- _reactionController.forward();
- markNeedsPaint();
- }
- }
-
- void _handleDragUpdate(DragUpdateDetails details) {
- if (isInteractive) {
- _currentDragValue += details.primaryDelta / _trackLength;
- onChanged(_discretizedCurrentDragValue);
- }
- }
-
- void _handleDragEnd(DragEndDetails details) {
- if (_active) {
- _active = false;
- _currentDragValue = 0.0;
- _reactionController.reverse();
- markNeedsPaint();
- }
- }
-
- @override
- bool hitTestSelf(Offset position) => true;
-
- @override
- void handleEvent(PointerEvent event, BoxHitTestEntry entry) {
- assert(debugHandleEvent(event, entry));
- if (event is PointerDownEvent && isInteractive) {
- _drag.addPointer(event);
- }
- }
-
- ImageProvider _cachedThumbImage;
- BoxPainter _cachedThumbPainter;
-
- BoxDecoration _createDefaultThumbDecoration(ImageProvider image) {
- return new BoxDecoration(
- image: image == null ? null : new DecorationImage(image: image),
- shape: BoxShape.circle,
- boxShadow: null);
- }
-
- bool _isPaintingThumb = false;
-
- void _handleDecorationChanged() {
- // If the image decoration is available synchronously, we'll get called here
- // during paint. There's no reason to mark ourselves as needing paint if we
- // are already in the middle of painting. (In fact, doing so would trigger
- // an assert).
- if (!_isPaintingThumb) {
- markNeedsPaint();
- }
- }
-
- @override
- void paint(PaintingContext context, Offset offset) {
- final Canvas canvas = context.canvas;
-
- final double trackLength = _trackLength;
- final bool enabled = isInteractive;
- final double value = _position.value;
-
- final double additionalHeightForLabel = _getAdditionalHeightForLabel(label);
- final double trackCenter = offset.dy +
- (size.height - additionalHeightForLabel) / 2.0 +
- additionalHeightForLabel;
- final double trackLeft = offset.dx + _kReactionRadius;
- final double trackTop = trackCenter - 1.0;
- final double trackBottom = trackCenter + 1.0;
- final double trackRight = trackLeft + trackLength;
- final double trackActive = trackLeft + trackLength * value;
-
- final Paint primaryPaint = new Paint()
- ..color = enabled ? _activeColor : _kInactiveTrackColor;
- final Paint trackPaint = new Paint()
- ..color = _kTrackColorTween.evaluate(_reaction);
-
- final Offset thumbCenter = new Offset(trackActive, trackCenter);
- double thumbRadius = enabled
- ? _kThumbRadiusTween.evaluate(_reaction)
- : _kDisabledThumbRadius;
-
- double thumbStrokeWidth = 0.0; // if 0, we fill the thumb circle
- if (thumbImage != null) {
- // Don't fill the circle if you're drawing an image inside
- thumbStrokeWidth = 2.0;
- // Create a bigger circle if you have an image
- thumbRadius += 8.0;
- }
- if (value == 0) {
- // Don't fill the circle if you're drawing an image
- thumbStrokeWidth = 2.0;
- // Make the circle a bit smaller when value == 0.
- thumbRadius -= 1.0;
- }
-
- if (enabled) {
- final bool hasBalloon =
- _reaction.status != AnimationStatus.dismissed && label != null;
- final double trackActiveDelta = hasBalloon ? 0.0 : thumbRadius - 1.0;
- if (value > 0.0)
- canvas.drawRect(
- new Rect.fromLTRB(trackLeft, trackTop,
- trackActive - trackActiveDelta, trackBottom),
- primaryPaint);
- if (value < 1.0)
- canvas.drawRect(
- new Rect.fromLTRB(trackActive + trackActiveDelta, trackTop,
- trackRight, trackBottom),
- trackPaint);
- } else {
- if (value > 0.0)
- canvas.drawRect(
- new Rect.fromLTRB(trackLeft, trackTop,
- trackActive - thumbRadius - 2, trackBottom),
- trackPaint);
- if (value < 1.0)
- canvas.drawRect(
- new Rect.fromLTRB(trackActive + thumbRadius + 2, trackTop,
- trackRight, trackBottom),
- trackPaint);
- }
-
- if (_reaction.status != AnimationStatus.dismissed) {
- final int divisions = this.divisions;
- if (divisions != null) {
- const double tickWidth = 2.0;
- final double dx = (trackLength - tickWidth) / divisions;
- // If the ticks would be too dense, don't bother painting them.
- if (dx >= 3 * tickWidth) {
- final Paint tickPaint = new Paint()
- ..color = _kTickColorTween.evaluate(_reaction);
- for (int i = 0; i <= divisions; i += 1) {
- final double left = trackLeft + i * dx;
- canvas.drawRect(
- new Rect.fromLTRB(
- left, trackTop, left + tickWidth, trackBottom),
- tickPaint);
- }
- }
- }
-
- if (label != null) {
- final Offset center = new Offset(trackActive,
- _kLabelBalloonCenterTween.evaluate(_reaction) + trackCenter);
- final double radius = _kLabelBalloonRadiusTween.evaluate(_reaction);
- final Offset tip = new Offset(trackActive,
- _kLabelBalloonTipTween.evaluate(_reaction) + trackCenter);
- final double tipAttachment = _kLabelBalloonTipAttachmentRatio * radius;
-
- Path path = new Path()
- ..moveTo(tip.dx, tip.dy)
- ..lineTo(center.dx - tipAttachment, center.dy + tipAttachment)
- ..lineTo(center.dx + tipAttachment, center.dy + tipAttachment)
- ..close();
- canvas.drawPath(path, primaryPaint);
- _labelPainter.layout();
- Offset labelOffset = new Offset(center.dx - _labelPainter.width / 2.0,
- center.dy - _labelPainter.height / 2.0);
- _labelPainter.paint(canvas, labelOffset);
- return;
- } else {
- // Don't draw a reaction circle if you have an icon
- if (thumbImage == null) {
- final Color reactionBaseColor =
- value == 0.0 ? _kActiveTrackColor : _activeColor;
- final Paint reactionPaint = new Paint()
- ..color = reactionBaseColor.withAlpha(kRadialReactionAlpha);
-
- canvas.drawCircle(thumbCenter,
- _kReactionRadiusTween.evaluate(_reaction), reactionPaint);
- }
- }
- }
-
- // Use the neutral color to draw thumb circle
- Paint thumbPaint = trackPaint;
-
- if (thumbStrokeWidth != 0.0) {
- // Set the style to stroke if we've set a non-zero stroke width
- // This destructive to trackingPaint or primaryPaint
- thumbPaint
- ..style = PaintingStyle.stroke
- ..strokeWidth = thumbStrokeWidth;
- }
-
- canvas.drawCircle(thumbCenter, thumbRadius, thumbPaint);
-
- if (thumbImage != null) {
- try {
- _isPaintingThumb = true;
- if (_cachedThumbPainter == null || thumbImage != _cachedThumbImage) {
- _cachedThumbImage = thumbImage;
- _cachedThumbPainter = _createDefaultThumbDecoration(thumbImage)
- .createBoxPainter(_handleDecorationChanged);
- }
-
- BoxPainter thumbPainter = _cachedThumbPainter;
-
- double imageRadius = thumbRadius - thumbStrokeWidth;
- thumbPainter.paint(
- canvas,
- thumbCenter - new Offset(imageRadius, imageRadius), // + offset
- configuration.copyWith(size: new Size.fromRadius(imageRadius)));
- } finally {
- _isPaintingThumb = false;
- }
- }
- }
-
- @override
- void describeSemanticsConfiguration(SemanticsConfiguration config) {
- super.describeSemanticsConfiguration(config);
-
- config.isSemanticBoundary = isInteractive;
- if (isInteractive) {
- config
- ..onIncrease = _increaseAction
- ..onDecrease = _decreaseAction;
- }
- }
-
- double get _semanticActionUnit =>
- divisions != null ? 1.0 / divisions : _kAdjustmentUnit;
-
- void _increaseAction() {
- if (isInteractive) {
- onChanged((value + _semanticActionUnit).clamp(0.0, 1.0));
- }
- }
-
- void _decreaseAction() {
- if (isInteractive) {
- onChanged((value - _semanticActionUnit).clamp(0.0, 1.0));
- }
- }
-}
diff --git a/shell/widgets/lib/key_mappings.dart b/shell/widgets/lib/key_mappings.dart
deleted file mode 100644
index 9908494..0000000
--- a/shell/widgets/lib/key_mappings.dart
+++ /dev/null
@@ -1,246 +0,0 @@
-// Copyright 2016 The Fuchsia 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' show Platform;
-
-const int _kAndroidMetaStateNormal = 0;
-const int _kAndroidMetaStateLeftShiftDown = 65;
-const int _kAndroidMetaStateRightShiftDown = 129;
-// ignore: unused_element
-const int _kAndroidMetaStateAltDown = 18;
-// ignore: unused_element
-const int _kAndroidMetaStateCtrlDown = 12288;
-
-const Map<int, String> _kAndroidKeyCodeMap = const <int, String>{
- 7: '0',
- 8: '1',
- 9: '2',
- 10: '3',
- 11: '4',
- 12: '5',
- 13: '6',
- 14: '7',
- 15: '8',
- 16: '9',
- 29: 'a',
- 30: 'b',
- 31: 'c',
- 32: 'd',
- 33: 'e',
- 34: 'f',
- 35: 'g',
- 36: 'h',
- 37: 'i',
- 38: 'j',
- 39: 'k',
- 40: 'l',
- 41: 'm',
- 42: 'n',
- 43: 'o',
- 44: 'p',
- 45: 'q',
- 46: 'r',
- 47: 's',
- 48: 't',
- 49: 'u',
- 50: 'v',
- 51: 'w',
- 52: 'x',
- 53: 'y',
- 54: 'z',
- 55: ',',
- 56: '.',
- 62: ' ',
- 69: '-',
- 70: '=',
- 74: ';',
- 75: '\'',
- 76: '/'
-};
-
-const Map<int, String> _kAndroidShiftedKeyCodeMap = const <int, String>{
- 7: ')',
- 8: '!',
- 9: '@',
- 10: '#',
- 11: '\$',
- 12: '%',
- 13: '^',
- 14: '&',
- 15: '*',
- 16: '(',
- 29: 'A',
- 30: 'B',
- 31: 'C',
- 32: 'D',
- 33: 'E',
- 34: 'F',
- 35: 'G',
- 36: 'H',
- 37: 'I',
- 38: 'J',
- 39: 'K',
- 40: 'L',
- 41: 'M',
- 42: 'N',
- 43: 'O',
- 44: 'P',
- 45: 'Q',
- 46: 'R',
- 47: 'S',
- 48: 'T',
- 49: 'U',
- 50: 'V',
- 51: 'W',
- 52: 'X',
- 53: 'Y',
- 54: 'Z',
- 55: '<',
- 56: '>',
- 62: ' ',
- 69: '_',
- 70: '+',
- 74: ':',
- 75: '"',
- 76: '?'
-};
-
-const int _kAndroidKeyCodeEnter = 66;
-const int _kAndroidKeyCodeBackspace = 67;
-
-const int _kLinuxMetaStateNormal = 0;
-const int _kLinuxMetaStateLeftShiftDown = 1;
-const int _kLinuxMetaStateRightShiftDown = 1;
-// ignore: unused_element
-const int _kLinuxMetaStateAltDown = 2;
-// ignore: unused_element
-const int _kLinuxMetaStateCtrlDown = 4096;
-
-const Map<int, String> _kLinuxKeyCodeMap = const <int, String>{
- 48: '0',
- 49: '1',
- 50: '2',
- 51: '3',
- 52: '4',
- 53: '5',
- 54: '6',
- 55: '7',
- 56: '8',
- 57: '9',
- 65: 'a',
- 66: 'b',
- 67: 'c',
- 68: 'd',
- 69: 'e',
- 70: 'f',
- 71: 'g',
- 72: 'h',
- 73: 'i',
- 74: 'j',
- 75: 'k',
- 76: 'l',
- 77: 'm',
- 78: 'n',
- 79: 'o',
- 80: 'p',
- 81: 'q',
- 82: 'r',
- 83: 's',
- 84: 't',
- 85: 'u',
- 86: 'v',
- 87: 'w',
- 88: 'x',
- 89: 'y',
- 90: 'z',
- 188: ',',
- 190: '.',
- 32: ' ',
- 189: '-',
- 187: '=',
- 186: ';',
- 222: '\'',
- 191: '/'
-};
-
-const Map<int, String> _kLinuxShiftedKeyCodeMap = const <int, String>{
- 48: ')',
- 49: '!',
- 50: '@',
- 51: '#',
- 52: '\$',
- 53: '%',
- 54: '^',
- 55: '&',
- 56: '*',
- 57: '(',
- 65: 'A',
- 66: 'B',
- 67: 'C',
- 68: 'D',
- 69: 'E',
- 70: 'F',
- 71: 'G',
- 72: 'H',
- 73: 'I',
- 74: 'J',
- 75: 'K',
- 76: 'L',
- 77: 'M',
- 78: 'N',
- 79: 'O',
- 80: 'P',
- 81: 'Q',
- 82: 'R',
- 83: 'S',
- 84: 'T',
- 85: 'U',
- 86: 'V',
- 87: 'W',
- 88: 'X',
- 89: 'Y',
- 90: 'Z',
- 188: '<',
- 190: '>',
- 32: ' ',
- 189: '_',
- 187: '+',
- 186: ':',
- 222: '"',
- 191: '?'
-};
-
-const int _kLinuxKeyCodeEnter = 13;
-const int _kLinuxKeyCodeBackspace = 8;
-
-/// The keycode for backspace on the current platform.
-int get keyCodeBackspace =>
- Platform.isAndroid ? _kAndroidKeyCodeBackspace : _kLinuxKeyCodeBackspace;
-
-/// The keycode for enter on the current platform.
-int get keyCodeEnter =>
- Platform.isAndroid ? _kAndroidKeyCodeEnter : _kLinuxKeyCodeEnter;
-
-/// The metastate indicating no modifications apply to the keycode on the
-/// current platform.
-int get metaStateNormal =>
- Platform.isAndroid ? _kAndroidMetaStateNormal : _kLinuxMetaStateNormal;
-
-/// The metastate indicating the left shift is down on the current platform.
-int get metaStateLeftShiftDown => Platform.isAndroid
- ? _kAndroidMetaStateLeftShiftDown
- : _kLinuxMetaStateLeftShiftDown;
-
-/// The metastate indicating the right shift is down on the current platform.
-int get metaStateRightShiftDown => Platform.isAndroid
- ? _kAndroidMetaStateRightShiftDown
- : _kLinuxMetaStateRightShiftDown;
-
-/// Maps keycodes to text on the current platform.
-Map<int, String> get keyCodeMap =>
- Platform.isAndroid ? _kAndroidKeyCodeMap : _kLinuxKeyCodeMap;
-
-/// Maps shifted keycodes to text on the current platform.
-Map<int, String> get shiftedKeyCodeMap =>
- Platform.isAndroid ? _kAndroidShiftedKeyCodeMap : _kLinuxShiftedKeyCodeMap;
diff --git a/shell/widgets/lib/three_column_aligned_layout_delegate.dart b/shell/widgets/lib/three_column_aligned_layout_delegate.dart
deleted file mode 100644
index a544ac2..0000000
--- a/shell/widgets/lib/three_column_aligned_layout_delegate.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2016 The Fuchsia 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/widgets.dart';
-
-/// See [ThreeColumnAlignedLayoutDelegate] for details.
-enum ThreeColumnAlignedLayoutDelegateParts {
- /// Indicates the widget is left aligned and can use up as much space as it
- /// wants.
- left,
-
- /// Indicates the widget is centered if it can do so without getting to close
- /// ([ThreeColumnAlignedLayoutDelegate.partMargin]) to the other
- /// [ThreeColumnAlignedLayoutDelegateParts]. If it cannot be centered, it
- /// will keep a minimum distance
- /// ([ThreeColumnAlignedLayoutDelegate.partMargin]) from [left] and [right]
- /// while trying to be as close to center as possible.
- center,
-
- /// Indicates the widget is right aligned and can use up as much space as it
- /// wants.
- right,
-}
-
-/// Lays out [ThreeColumnAlignedLayoutDelegateParts] as follows:
-/// 1. All [ThreeColumnAlignedLayoutDelegateParts] are vertically centered.
-/// 2. [ThreeColumnAlignedLayoutDelegateParts.left] is left aligned and can use
-/// up as much space as it likes.
-/// 3. [ThreeColumnAlignedLayoutDelegateParts.right] is right aligned and can
-/// use up as much space as it likes.
-/// 4. [ThreeColumnAlignedLayoutDelegateParts.center] is centered if it can do
-/// so without getting to close ([partMargin]) to the other
-/// [ThreeColumnAlignedLayoutDelegateParts]. If it cannot be centered, it
-/// will keep a minimum distance ([partMargin]) from
-/// [ThreeColumnAlignedLayoutDelegateParts.left] and
-/// [ThreeColumnAlignedLayoutDelegateParts.right] while trying to be as close
-/// to center as possible.
-class ThreeColumnAlignedLayoutDelegate extends MultiChildLayoutDelegate {
- /// The minimum distance [ThreeColumnAlignedLayoutDelegateParts.center] can be
- /// to [ThreeColumnAlignedLayoutDelegateParts.left] and
- /// [ThreeColumnAlignedLayoutDelegateParts.right].
- final double partMargin;
-
- /// Constructor.
- ThreeColumnAlignedLayoutDelegate({this.partMargin});
-
- @override
- void performLayout(Size size) {
- // Lay out children.
- Size leftSize = layoutChild(ThreeColumnAlignedLayoutDelegateParts.left,
- new BoxConstraints.loose(size));
- Size rightSize = layoutChild(ThreeColumnAlignedLayoutDelegateParts.right,
- new BoxConstraints.loose(size));
- Size centerSize = layoutChild(
- ThreeColumnAlignedLayoutDelegateParts.center,
- new BoxConstraints.loose(size).deflate(new EdgeInsets.only(
- left: partMargin + leftSize.width,
- right: partMargin + rightSize.width)));
-
- // Position children.
- positionChild(ThreeColumnAlignedLayoutDelegateParts.left,
- new Offset(0.0, (size.height - leftSize.height) / 2.0));
- positionChild(
- ThreeColumnAlignedLayoutDelegateParts.right,
- new Offset(size.width - rightSize.width,
- (size.height - rightSize.height) / 2.0));
- double centerLeft = (size.width - centerSize.width) / 2.0;
- if (centerLeft < leftSize.width + partMargin) {
- // If we're too close to the left element, shift to the right.
- centerLeft = leftSize.width + partMargin;
- } else if (centerLeft + centerSize.width > size.width - rightSize.width) {
- // If we're too close to the right element, shift to the left.
- centerLeft = size.width - rightSize.width - centerSize.width;
- }
- positionChild(ThreeColumnAlignedLayoutDelegateParts.center,
- new Offset(centerLeft, (size.height - centerSize.height) / 2.0));
- }
-
- @override
- bool shouldRelayout(ThreeColumnAlignedLayoutDelegate oldDelegate) =>
- partMargin != oldDelegate.partMargin;
-}
diff --git a/shell/widgets/pubspec.yaml b/shell/widgets/pubspec.yaml
deleted file mode 100644
index 2703d4d..0000000
--- a/shell/widgets/pubspec.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2016 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-name: sysui_widgets
-dependencies:
- flutter:
- sdk: flutter
-dev_dependencies:
- # Note that this dependency also gets us the test package.
- # Not specifying test explicitly here to ensure we use the same version as
- # Flutter.
- flutter_test:
- sdk: flutter
- typed_mock: ^0.0.4