diff --git a/animations/lib/src/misc/carousel.dart b/animations/lib/src/misc/carousel.dart index 37c0bc865..02e903d74 100644 --- a/animations/lib/src/misc/carousel.dart +++ b/animations/lib/src/misc/carousel.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; class CarouselDemo extends StatelessWidget { @@ -80,8 +80,8 @@ class _CarouselState extends State { controller: _controller, scrollBehavior: ScrollConfiguration.of(context).copyWith( dragDevices: { - PointerDeviceKind.touch, - PointerDeviceKind.mouse, + ui.PointerDeviceKind.touch, + ui.PointerDeviceKind.mouse, }, ), itemBuilder: (context, index) => AnimatedBuilder( diff --git a/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart b/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart index 8d33345e9..b1c92508e 100644 --- a/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart +++ b/experimental/varfont_shader_puzzle/lib/components/wonky_char.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; import 'package:flutter/foundation.dart' show kDebugMode; import 'package:flutter/material.dart'; @@ -78,10 +78,10 @@ class WonkyCharState extends State @override Widget build(BuildContext context) { - List fontVariations = []; + List fontVariations = []; for (int i = 0; i < _fvAxes.length; i++) { fontVariations - .add(FontVariation(_fvAxes[i], _fvAnimations[i].value as double)); + .add(ui.FontVariation(_fvAxes[i], _fvAnimations[i].value as double)); } return Transform( alignment: Alignment.center, diff --git a/next_gen_ui_demo/lib/assets.dart b/next_gen_ui_demo/lib/assets.dart index 6f1e29b0b..e2efd0586 100644 --- a/next_gen_ui_demo/lib/assets.dart +++ b/next_gen_ui_demo/lib/assets.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; class AssetPaths { /// Images @@ -29,13 +29,13 @@ class AssetPaths { static const String uiShader = '$_shaders/ui_glitch.frag'; } -typedef Shaders = ({FragmentShader orb, FragmentShader ui}); +typedef Shaders = ({ui.FragmentShader orb, ui.FragmentShader ui}); Future loadShaders() async => ( orb: (await _loadShader(AssetPaths.orbShader)), ui: (await _loadShader(AssetPaths.uiShader)), ); -Future _loadShader(String path) async { - return (await FragmentProgram.fromAsset(path)).fragmentShader(); +Future _loadShader(String path) async { + return (await ui.FragmentProgram.fromAsset(path)).fragmentShader(); } diff --git a/next_gen_ui_demo/lib/common/shader_painter.dart b/next_gen_ui_demo/lib/common/shader_painter.dart index d6a4a5925..c58d44da4 100644 --- a/next_gen_ui_demo/lib/common/shader_painter.dart +++ b/next_gen_ui_demo/lib/common/shader_painter.dart @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; class ShaderPainter extends CustomPainter { ShaderPainter(this.shader, {this.update}); - final FragmentShader shader; - final void Function(FragmentShader, Size)? update; + final ui.FragmentShader shader; + final void Function(ui.FragmentShader, Size)? update; @override void paint(Canvas canvas, Size size) { diff --git a/next_gen_ui_demo/lib/orb_shader/orb_shader_painter.dart b/next_gen_ui_demo/lib/orb_shader/orb_shader_painter.dart index 50213545d..8fa6f3deb 100644 --- a/next_gen_ui_demo/lib/orb_shader/orb_shader_painter.dart +++ b/next_gen_ui_demo/lib/orb_shader/orb_shader_painter.dart @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:math'; -import 'dart:ui'; +import 'dart:math' as math; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:vector_math/vector_math_64.dart' as v64; @@ -18,7 +18,7 @@ class OrbShaderPainter extends CustomPainter { required this.mousePos, required this.energy, }); - final FragmentShader shader; + final ui.FragmentShader shader; final OrbShaderConfig config; final double time; final Offset mousePos; @@ -26,7 +26,8 @@ class OrbShaderPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - double fov = v64.mix(pi / 4.3, pi / 2.0, config.zoom.clamp(0.0, 1.0)); + double fov = + v64.mix(math.pi / 4.3, math.pi / 2.0, config.zoom.clamp(0.0, 1.0)); v64.Vector3 colorToVector3(Color c) => v64.Vector3( @@ -37,16 +38,16 @@ class OrbShaderPainter extends CustomPainter { 255.0; v64.Vector3 lightLumP = colorToVector3(config.lightColor).normalized() * - max(0.0, config.lightBrightness); + math.max(0.0, config.lightBrightness); v64.Vector3 albedo = colorToVector3(config.materialColor); v64.Vector3 ambientLight = colorToVector3(config.ambientLightColor) * - max(0.0, config.ambientLightBrightness); + math.max(0.0, config.ambientLightBrightness); shader.setFloat(0, size.width); shader.setFloat(1, size.height); shader.setFloat(2, time); - shader.setFloat(3, max(0.0, config.exposure)); + shader.setFloat(3, math.max(0.0, config.exposure)); shader.setFloat(4, fov); shader.setFloat(5, config.roughness.clamp(0.0, 1.0)); shader.setFloat(6, config.metalness.clamp(0.0, 1.0)); diff --git a/next_gen_ui_demo/lib/orb_shader/orb_shader_widget.dart b/next_gen_ui_demo/lib/orb_shader/orb_shader_widget.dart index 31b6ede2e..b3a07001c 100644 --- a/next_gen_ui_demo/lib/orb_shader/orb_shader_widget.dart +++ b/next_gen_ui_demo/lib/orb_shader/orb_shader_widget.dart @@ -3,8 +3,8 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:math'; -import 'dart:ui'; +import 'dart:math' as math; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; @@ -95,13 +95,13 @@ class OrbShaderWidgetState extends State widget.mousePos) .distance; final hitSize = size.shortestSide * .5; - energyLevel = 1 - min(1, (d / hitSize)); + energyLevel = 1 - math.min(1, (d / hitSize)); scheduleMicrotask( () => widget.onUpdate?.call(energyLevel)); } energyLevel += (1.3 - energyLevel) * heartbeatEnergy * 0.1; - energyLevel = lerpDouble(minEnergy, 1, energyLevel)!; + energyLevel = ui.lerpDouble(minEnergy, 1, energyLevel)!; return CustomPaint( size: size, painter: OrbShaderPainter( diff --git a/next_gen_ui_demo/lib/title_screen_5b/title_screen.dart b/next_gen_ui_demo/lib/title_screen_5b/title_screen.dart index 71d730729..64bdaa978 100644 --- a/next_gen_ui_demo/lib/title_screen_5b/title_screen.dart +++ b/next_gen_ui_demo/lib/title_screen_5b/title_screen.dart @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:math'; -import 'dart:ui'; +import 'dart:math' as math; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -54,17 +54,19 @@ class _TitleScreenState extends State double get _finalReceiveLightAmt { final light = - lerpDouble(_minReceiveLightAmt, _maxReceiveLightAmt, _orbEnergy) ?? 0; + ui.lerpDouble(_minReceiveLightAmt, _maxReceiveLightAmt, _orbEnergy) ?? + 0; return light + _pulseEffect.value * .05 * _orbEnergy; } double get _finalEmitLightAmt { - return lerpDouble(_minEmitLightAmt, _maxEmitLightAmt, _orbEnergy) ?? 0; + return ui.lerpDouble(_minEmitLightAmt, _maxEmitLightAmt, _orbEnergy) ?? 0; } late final AnimationController _pulseEffect; - Duration _getRndPulseDuration() => 100.ms + 200.ms * Random().nextDouble(); + Duration _getRndPulseDuration() => + 100.ms + 200.ms * math.Random().nextDouble(); double _getMinEnergyForDifficulty(int difficulty) { if (difficulty == 1) { diff --git a/next_gen_ui_demo/lib/title_screen_6/title_screen.dart b/next_gen_ui_demo/lib/title_screen_6/title_screen.dart index dc39e0288..2a823be59 100644 --- a/next_gen_ui_demo/lib/title_screen_6/title_screen.dart +++ b/next_gen_ui_demo/lib/title_screen_6/title_screen.dart @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:math'; -import 'dart:ui'; +import 'dart:math' as math; +import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -55,17 +55,19 @@ class _TitleScreenState extends State double get _finalReceiveLightAmt { final light = - lerpDouble(_minReceiveLightAmt, _maxReceiveLightAmt, _orbEnergy) ?? 0; + ui.lerpDouble(_minReceiveLightAmt, _maxReceiveLightAmt, _orbEnergy) ?? + 0; return light + _pulseEffect.value * .05 * _orbEnergy; } double get _finalEmitLightAmt { - return lerpDouble(_minEmitLightAmt, _maxEmitLightAmt, _orbEnergy) ?? 0; + return ui.lerpDouble(_minEmitLightAmt, _maxEmitLightAmt, _orbEnergy) ?? 0; } late final AnimationController _pulseEffect; - Duration _getRndPulseDuration() => 100.ms + 200.ms * Random().nextDouble(); + Duration _getRndPulseDuration() => + 100.ms + 200.ms * math.Random().nextDouble(); double _getMinEnergyForDifficulty(int difficulty) { if (difficulty == 1) { diff --git a/veggieseasons/lib/widgets/close_button.dart b/veggieseasons/lib/widgets/close_button.dart index e1370f8e5..7eb11891c 100644 --- a/veggieseasons/lib/widgets/close_button.dart +++ b/veggieseasons/lib/widgets/close_button.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; import 'package:flutter/cupertino.dart'; import 'package:veggieseasons/styles.dart'; @@ -19,7 +19,7 @@ class FrostedBox extends StatelessWidget { @override Widget build(BuildContext context) { return BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + filter: ui.ImageFilter.blur(sigmaX: 10, sigmaY: 10), child: DecoratedBox( decoration: const BoxDecoration( color: Styles.frostedBackground, diff --git a/veggieseasons/lib/widgets/veggie_card.dart b/veggieseasons/lib/widgets/veggie_card.dart index 4faa7c2cc..bf6dd154f 100644 --- a/veggieseasons/lib/widgets/veggie_card.dart +++ b/veggieseasons/lib/widgets/veggie_card.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:ui'; +import 'dart:ui' as ui; import 'package:flutter/cupertino.dart'; import 'package:go_router/go_router.dart'; @@ -25,7 +25,7 @@ class FrostyBackground extends StatelessWidget { Widget build(BuildContext context) { return ClipRect( child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: intensity, sigmaY: intensity), + filter: ui.ImageFilter.blur(sigmaX: intensity, sigmaY: intensity), child: DecoratedBox( decoration: BoxDecoration( color: color,