pull/2701/head
Eric Windmill 2 months ago
parent a511846ed4
commit 50ecc5afea

@ -23,7 +23,8 @@ class Cell extends StatefulWidget {
class _CellState extends State<Cell> with WidgetsBindingObserver {
static const double gravity = 9.81;
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
static final AccelerometerEvent defaultPosition =
AccelerometerEvent(0, 0, 0);
int cellNumber = 0;
Random? _random;
@ -82,7 +83,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
builder: (context) {
return Card(
// Mimic the platform Material look.
margin: const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
margin:
const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
@ -112,22 +114,22 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
child: StreamBuilder<AccelerometerEvent>(
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
? accelerometerEventStream()
: Stream.value(defaultPosition),
stream:
appLifecycleState == AppLifecycleState.resumed
? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {
return Transform(
// Figure out the phone's orientation relative
// to gravity's direction. Ignore the z vector.
transform:
Matrix4.rotationX(
snapshot.data!.y / gravity * pi / 2,
)..multiply(
Matrix4.rotationY(
snapshot.data!.x / gravity * pi / 2,
),
transform: Matrix4.rotationX(
snapshot.data!.y / gravity * pi / 2,
)..multiply(
Matrix4.rotationY(
snapshot.data!.x / gravity * pi / 2,
),
),
alignment: Alignment.center,
child: const FlutterLogo(size: 72),
);

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: ^3.9.0-0
dependencies:
flutter:

@ -24,7 +24,8 @@ class Book {
pigeonMap['summary'] = summary;
pigeonMap['publishDate'] = publishDate;
pigeonMap['pageCount'] = pageCount;
pigeonMap['thumbnail'] = thumbnail == null ? null : thumbnail!.encode();
pigeonMap['thumbnail'] =
thumbnail == null ? null : thumbnail!.encode();
return pigeonMap;
}
@ -167,9 +168,10 @@ class HostBookApi {
}
Future<void> finishEditingBook(Book arg_book) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostBookApi.finishEditingBook', codec,
binaryMessenger: _binaryMessenger);
final BasicMessageChannel<Object?> channel =
BasicMessageChannel<Object?>(
'dev.flutter.pigeon.HostBookApi.finishEditingBook', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
await channel.send(<Object>[arg_book]) as Map<Object?, Object?>?;
if (replyMap == null) {

@ -6,7 +6,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: ^3.9.0-0
dependencies:
flutter:

@ -20,7 +20,8 @@ void main() {
expect(mockHostApi.cancelCalls, 1);
});
testWidgets('Pressing done calls the finish editing API', (tester) async {
testWidgets('Pressing done calls the finish editing API',
(tester) async {
MockHostBookApi mockHostApi = MockHostBookApi();
await tester.pumpWidget(

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: ^3.9.0-0
dependencies:
flutter:

@ -82,7 +82,8 @@ class _MyHomePageState extends State<MyHomePage> {
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
TextButton(onPressed: _incrementCounter, child: const Text('Add')),
TextButton(
onPressed: _incrementCounter, child: const Text('Add')),
TextButton(
onPressed: () {
_channel.invokeMethod<void>("next", _counter);

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: ^3.9.0-0
dependencies:
flutter:

@ -23,7 +23,8 @@ class Cell extends StatefulWidget {
class _CellState extends State<Cell> with WidgetsBindingObserver {
static const double gravity = 9.81;
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
static final AccelerometerEvent defaultPosition =
AccelerometerEvent(0, 0, 0);
int cellNumber = 0;
Random? _random;
@ -82,7 +83,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
builder: (context) {
return Card(
// Mimic the platform Material look.
margin: const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
margin:
const EdgeInsets.symmetric(horizontal: 36, vertical: 24),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
@ -112,24 +114,26 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
child: StreamBuilder<AccelerometerEvent>(
// Don't continuously rebuild for nothing when the
// cell isn't visible.
stream: appLifecycleState == AppLifecycleState.resumed
? accelerometerEventStream()
: Stream.value(defaultPosition),
stream:
appLifecycleState == AppLifecycleState.resumed
? accelerometerEventStream()
: Stream.value(defaultPosition),
initialData: defaultPosition,
builder: (context, snapshot) {
final data = snapshot.data;
if (data == null) {
return const CircularProgressIndicator.adaptive();
return const CircularProgressIndicator
.adaptive();
}
return Transform(
// Figure out the phone's orientation relative
// to gravity's direction. Ignore the z vector.
transform:
Matrix4.rotationX(
data.y / gravity * pi / 2,
)..multiply(
Matrix4.rotationY(data.x / gravity * pi / 2),
),
transform: Matrix4.rotationX(
data.y / gravity * pi / 2,
)..multiply(
Matrix4.rotationY(
data.x / gravity * pi / 2),
),
alignment: Alignment.center,
child: const FlutterLogo(size: 72),
);

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ publish_to: none
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
# NOTE: Code is not allowed in this package. Do not add more dependencies.
# The `flutter_lints` dependency is required for `lib/flutter.yaml`.

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -21,7 +21,8 @@ const double windowWidth = 480;
const double windowHeight = 854;
void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
if (!kIsWeb &&
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle('Animation Samples');
setWindowMinSize(const Size(windowWidth, windowHeight));
@ -43,7 +44,8 @@ class Demo {
final String route;
final WidgetBuilder builder;
const Demo({required this.name, required this.route, required this.builder});
const Demo(
{required this.name, required this.route, required this.builder});
}
final basicDemos = [

@ -49,7 +49,8 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
animation: animation,
builder: (context, child) {
return ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: animation.value),
style: ElevatedButton.styleFrom(
backgroundColor: animation.value),
child: child,
onPressed: () {
switch (controller.status) {

@ -15,7 +15,8 @@ class AnimatedContainerDemo extends StatefulWidget {
static String routeName = 'basics/animated_container';
@override
State<AnimatedContainerDemo> createState() => _AnimatedContainerDemoState();
State<AnimatedContainerDemo> createState() =>
_AnimatedContainerDemoState();
}
class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {

@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
class TypewriterTween extends Tween<String> {
TypewriterTween({String begin = '', String end = ''})
: super(begin: begin, end: end);
: super(begin: begin, end: end);
@override
String lerp(double t) {

@ -49,14 +49,13 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
children: [
FadeTransition(
opacity: _animation,
child: const Icon(Icons.star, color: Colors.amber, size: 300),
child:
const Icon(Icons.star, color: Colors.amber, size: 300),
),
ElevatedButton(
child: const Text('animate'),
onPressed: () => setState(() {
_controller
.animateTo(1.0)
.then<TickerFuture>(
_controller.animateTo(1.0).then<TickerFuture>(
(value) => _controller.animateBack(0.0),
);
}),

@ -74,7 +74,8 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
child: child,
);
},
child: const Text('Animate', style: TextStyle(color: Colors.white)),
child:
const Text('Animate', style: TextStyle(color: Colors.white)),
),
),
);

@ -75,7 +75,9 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
return Scaffold(
appBar: AppBar(
title: const Text('AnimatedList'),
actions: [IconButton(icon: const Icon(Icons.add), onPressed: addUser)],
actions: [
IconButton(icon: const Icon(Icons.add), onPressed: addUser)
],
),
body: SafeArea(
child: AnimatedList(

@ -11,7 +11,8 @@ class AnimatedPositionedDemo extends StatefulWidget {
static String routeName = 'misc/animated_positioned';
@override
State<AnimatedPositionedDemo> createState() => _AnimatedPositionedDemoState();
State<AnimatedPositionedDemo> createState() =>
_AnimatedPositionedDemoState();
}
class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
@ -55,7 +56,8 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
duration: const Duration(seconds: 1),
child: InkWell(
onTap: () => changePosition(
size.height - (appBar.preferredSize.height + topPadding + 50),
size.height -
(appBar.preferredSize.height + topPadding + 50),
size.width - 150,
),
child: Container(

@ -9,25 +9,26 @@ import 'package:flutter/material.dart';
Color generateColor() => Color(0xFFFFFFFF & Random().nextInt(0xFFFFFFFF));
Widget generateContainer(int keyCount) => Container(
key: ValueKey<int>(keyCount),
height: Random().nextDouble() * 200,
width: Random().nextDouble() * 200,
decoration: BoxDecoration(
color: generateColor(),
borderRadius: BorderRadius.circular(Random().nextDouble() * 100),
border: Border.all(
color: generateColor(),
width: Random().nextDouble() * 5,
),
),
);
key: ValueKey<int>(keyCount),
height: Random().nextDouble() * 200,
width: Random().nextDouble() * 200,
decoration: BoxDecoration(
color: generateColor(),
borderRadius: BorderRadius.circular(Random().nextDouble() * 100),
border: Border.all(
color: generateColor(),
width: Random().nextDouble() * 5,
),
),
);
class AnimatedSwitcherDemo extends StatefulWidget {
const AnimatedSwitcherDemo({super.key});
static String routeName = 'misc/animated_switcher';
@override
State<AnimatedSwitcherDemo> createState() => _AnimatedSwitcherDemoState();
State<AnimatedSwitcherDemo> createState() =>
_AnimatedSwitcherDemoState();
}
class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {

@ -174,7 +174,8 @@ class _SwipeableCardState extends State<SwipeableCard>
return;
}
var velocity = (details.velocity.pixelsPerSecond.dx / size.width).abs();
var velocity =
(details.velocity.pixelsPerSecond.dx / size.width).abs();
_animate(velocity: velocity);
}

@ -78,12 +78,16 @@ class _CarouselState extends State<Carousel> {
},
controller: _controller,
scrollBehavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {ui.PointerDeviceKind.touch, ui.PointerDeviceKind.mouse},
dragDevices: {
ui.PointerDeviceKind.touch,
ui.PointerDeviceKind.mouse
},
),
itemBuilder: (context, index) => AnimatedBuilder(
animation: _controller,
builder: (context, child) {
var result = _pageHasChanged ? _controller.page! : _currentPage * 1.0;
var result =
_pageHasChanged ? _controller.page! : _currentPage * 1.0;
// The horizontal position of the page between a 1 and 0
var value = result - index;

@ -64,19 +64,18 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
controller.reverse();
}
});
animationTranslation =
Tween<Offset>(
begin: const Offset(-1, 0),
end: const Offset(1, 0),
).animate(curvedAnimation)
..addListener(() {
setState(() {});
})
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
controller.reverse();
}
});
animationTranslation = Tween<Offset>(
begin: const Offset(-1, 0),
end: const Offset(1, 0),
).animate(curvedAnimation)
..addListener(() {
setState(() {});
})
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
controller.reverse();
}
});
}
@override
@ -123,7 +122,8 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
if (newCurve != null) {
setState(() {
selectedReverseCurve = newCurve;
curvedAnimation.reverseCurve = selectedReverseCurve.curve;
curvedAnimation.reverseCurve =
selectedReverseCurve.curve;
});
}
},

@ -60,16 +60,16 @@ class _ExpandCardState extends State<ExpandCard>
// size
layoutBuilder:
(topChild, topChildKey, bottomChild, bottomChildKey) {
return Stack(
children: [
Positioned.fill(
key: bottomChildKey,
child: bottomChild,
),
Positioned.fill(key: topChildKey, child: topChild),
],
);
},
return Stack(
children: [
Positioned.fill(
key: bottomChildKey,
child: bottomChild,
),
Positioned.fill(key: topChildKey, child: topChild),
],
);
},
firstChild: Image.asset(
'assets/eat_cape_town_sm.jpg',
fit: BoxFit.cover,

@ -18,21 +18,20 @@ class FlutterAnimateDemo extends StatelessWidget {
body: Center(
child: Padding(
padding: const EdgeInsets.all(16),
child:
Text(
"Hello Flutter Animate",
style: Theme.of(context).textTheme.headlineLarge,
)
.animate(onPlay: (controller) => controller.repeat())
.then(delay: 250.ms)
.fadeIn(duration: 500.ms)
.then(delay: 250.ms)
.shimmer(duration: 400.ms)
.then(delay: 250.ms)
.slide()
.then(delay: 250.ms)
.blur(duration: 500.ms)
.then(delay: 100.ms),
child: Text(
"Hello Flutter Animate",
style: Theme.of(context).textTheme.headlineLarge,
)
.animate(onPlay: (controller) => controller.repeat())
.then(delay: 250.ms)
.fadeIn(duration: 500.ms)
.then(delay: 250.ms)
.shimmer(duration: 400.ms)
.then(delay: 250.ms)
.slide()
.then(delay: 250.ms)
.blur(duration: 500.ms)
.then(delay: 100.ms),
),
),
);

@ -29,7 +29,8 @@ class Grid extends StatelessWidget {
),
itemBuilder: (context, index) {
return (index >= 20)
? const SmallCard(imageAssetName: 'assets/eat_cape_town_sm.jpg')
? const SmallCard(
imageAssetName: 'assets/eat_cape_town_sm.jpg')
: const SmallCard(
imageAssetName: 'assets/eat_new_orleans_sm.jpg',
);
@ -50,7 +51,9 @@ Route _createRoute(BuildContext parentContext, String image) {
).chain(CurveTween(curve: Curves.ease)).animate(animation);
return Stack(
children: [PositionedTransition(rect: rectAnimation, child: child)],
children: [
PositionedTransition(rect: rectAnimation, child: child)
],
);
},
);

@ -15,11 +15,13 @@ class HeroAnimationDemo extends StatelessWidget {
body: GestureDetector(
child: Hero(
tag: 'hero-page-child',
child: _createHeroContainer(size: 50.0, color: Colors.grey.shade300),
child: _createHeroContainer(
size: 50.0, color: Colors.grey.shade300),
),
onTap: () => Navigator.of(
context,
).push<void>(MaterialPageRoute(builder: (context) => const HeroPage())),
).push<void>(
MaterialPageRoute(builder: (context) => const HeroPage())),
),
);
}
@ -51,7 +53,9 @@ StatelessWidget _createHeroContainer({
height: size,
width: size,
padding: const EdgeInsets.all(10.0),
margin: size < 100.0 ? const EdgeInsets.all(10.0) : const EdgeInsets.all(0),
margin: size < 100.0
? const EdgeInsets.all(10.0)
: const EdgeInsets.all(0),
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
child: const FlutterLogo(),
);

@ -78,7 +78,8 @@ class _DraggableCardState extends State<DraggableCard>
void initState() {
super.initState();
_controller = AnimationController.unbounded(vsync: this)
..addListener(() => setState(() => _dragAlignment = _animation.value));
..addListener(
() => setState(() => _dragAlignment = _animation.value));
}
@override

@ -9,7 +9,8 @@ class RepeatingAnimationDemo extends StatefulWidget {
static String routeName = 'misc/repeating_animation';
@override
State<RepeatingAnimationDemo> createState() => _RepeatingAnimationDemoState();
State<RepeatingAnimationDemo> createState() =>
_RepeatingAnimationDemoState();
}
class _RepeatingAnimationDemoState extends State<RepeatingAnimationDemo>

@ -5,7 +5,7 @@ publish_to: none
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -16,7 +16,8 @@ void main() {
// Get the initial color of the button.
ElevatedButton button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? initialColor = button.style!.backgroundColor;
WidgetStateProperty<Color?>? initialColor =
button.style!.backgroundColor;
// Tap the button.
await tester.tap(find.byType(ElevatedButton));
@ -24,7 +25,8 @@ void main() {
// Get the updated color of the button.
button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? updatedColor = button.style!.backgroundColor;
WidgetStateProperty<Color?>? updatedColor =
button.style!.backgroundColor;
// Check if the color has changed.
expect(initialColor, isNot(updatedColor));
@ -35,7 +37,8 @@ void main() {
// Get the initial color of the button.
ElevatedButton button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? initialColor = button.style!.backgroundColor;
WidgetStateProperty<Color?>? initialColor =
button.style!.backgroundColor;
// Tap the button to trigger the animation but don't wait for it to finish.
await tester.tap(find.byType(ElevatedButton));
@ -44,7 +47,8 @@ void main() {
// Check that the color has changed but not to the final color.
button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? changedColor = button.style!.backgroundColor;
WidgetStateProperty<Color?>? changedColor =
button.style!.backgroundColor;
expect(initialColor, isNot(changedColor));
// Wait for the animation to finish.
@ -52,7 +56,8 @@ void main() {
// Check that the color has changed to the final color.
button = tester.widget(find.byType(ElevatedButton));
WidgetStateProperty<Color?>? finalColor = button.style!.backgroundColor;
WidgetStateProperty<Color?>? finalColor =
button.style!.backgroundColor;
expect(changedColor, isNot(finalColor));
});
});

@ -46,7 +46,8 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list.
var initialLength = tester.widgetList(find.byType(ListTile)).length;
var initialLength =
tester.widgetList(find.byType(ListTile)).length;
// Tap on the Delete Icon Button at middle index.
await tester.tap(find.byIcon(Icons.delete).at(initialLength ~/ 2));
@ -66,7 +67,8 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list.
var initialLength = tester.widgetList(find.byType(ListTile)).length;
var initialLength =
tester.widgetList(find.byType(ListTile)).length;
// Tap on the Delete Icon Button at start index.
await tester.tap(find.byIcon(Icons.delete).at(0));
@ -86,7 +88,8 @@ void main() {
await tester.pumpWidget(createAnimatedListDemoScreen());
// Get the initial length of list.
var initialLength = tester.widgetList(find.byType(ListTile)).length;
var initialLength =
tester.widgetList(find.byType(ListTile)).length;
// Tap on the Delete Icon Button at end index.
await tester.tap(find.byIcon(Icons.delete).at(initialLength - 1));

@ -24,7 +24,8 @@ void main() {
await tester.pumpAndSettle();
// Check if removed properly.
expect(tester.widgetList(find.byType(Card)).length, lessThan(totalCards));
expect(tester.widgetList(find.byType(Card)).length,
lessThan(totalCards));
});
testWidgets('All cards swiped out', (tester) async {
@ -36,7 +37,8 @@ void main() {
// Swipe out all cards.
for (var i = 0; i < totalCards; i++) {
// Swipe out one by one.
await tester.drag(find.byType(Card).last, const Offset(100.0, 0.0));
await tester.drag(
find.byType(Card).last, const Offset(100.0, 0.0));
await tester.pumpAndSettle();
}

@ -18,7 +18,8 @@ void main() {
expect(imageList.length, 2);
// Swipe the Carousel.
await tester.fling(find.byType(CarouselDemo), const Offset(-400, 0), 800);
await tester.fling(
find.byType(CarouselDemo), const Offset(-400, 0), 800);
await tester.pumpAndSettle();
// Get the images available on the screen after swipe.

@ -6,7 +6,8 @@ import 'package:animations/src/misc/expand_card.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Widget createExpandCardScreen() => const MaterialApp(home: ExpandCardDemo());
Widget createExpandCardScreen() =>
const MaterialApp(home: ExpandCardDemo());
void main() {
group('ExpandCard Tests', () {
@ -22,7 +23,8 @@ void main() {
// The size of ExpandCard must change once tapped.
// The initialSize should be less than current ExpandCard size.
expect(initialSize, lessThan(tester.getSize(find.byType(ExpandCard))));
expect(
initialSize, lessThan(tester.getSize(find.byType(ExpandCard))));
});
testWidgets('ExpandCard changes image on tap', (tester) async {

@ -6,7 +6,8 @@ import 'package:animations/src/misc/focus_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Widget createFocusImageScreen() => const MaterialApp(home: FocusImageDemo());
Widget createFocusImageScreen() =>
const MaterialApp(home: FocusImageDemo());
void main() {
group('FocusImage Tests', () {
@ -33,7 +34,8 @@ void main() {
expect(finalSize, greaterThan(initialSize));
});
testWidgets('Final inkwell on tap goes back to the grid', (tester) async {
testWidgets('Final inkwell on tap goes back to the grid',
(tester) async {
await tester.pumpWidget(createFocusImageScreen());
// Tap on the ink well at index 0.

@ -58,7 +58,8 @@ void main() {
// Final color should not be same as initial color.
expect(
(finalContainer.decoration as BoxDecoration).color,
isNot(equals((initialContainer.decoration as BoxDecoration).color)),
isNot(
equals((initialContainer.decoration as BoxDecoration).color)),
);
});
@ -66,7 +67,8 @@ void main() {
await tester.pumpWidget(createHeroAnimationDemoScreen());
// Get the initial Screen.
final initialScreen = tester.firstWidget(find.byType(HeroAnimationDemo));
final initialScreen =
tester.firstWidget(find.byType(HeroAnimationDemo));
// Tap on the GestureDetector.
await tester.tap(find.byType(GestureDetector));

@ -3,7 +3,7 @@ description: A sample command-line application.
version: 1.0.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: ^3.9.0-0
dependencies:
args: ^2.4.2

@ -5,7 +5,7 @@ version: 0.1.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -65,12 +65,12 @@ class _MyHomePageState extends State<MyHomePage> {
// Write the value to [SharedPreferences] which will get read on the
// [SimpleDatabase]'s isolate. For this example the value is always true
// just for demonstration purposes.
final Future<void> sharedPreferencesSet = SharedPreferences.getInstance()
.then(
(sharedPreferences) => sharedPreferences.setBool('isDebug', true),
);
final Future<Directory> tempDirFuture = path_provider
.getTemporaryDirectory();
final Future<void> sharedPreferencesSet =
SharedPreferences.getInstance().then(
(sharedPreferences) => sharedPreferences.setBool('isDebug', true),
);
final Future<Directory> tempDirFuture =
path_provider.getTemporaryDirectory();
// Wait until the [SharedPreferences] value is set and the temporary
// directory is received before opening the database. If

@ -181,14 +181,16 @@ class _SimpleDatabaseServer {
// obtained on the root isolate and passed into the background isolate via
// a [SendPort].
// ----------------------------------------------------------------------
RootIsolateToken rootIsolateToken = command.arg1 as RootIsolateToken;
RootIsolateToken rootIsolateToken =
command.arg1 as RootIsolateToken;
// ----------------------------------------------------------------------
// [BackgroundIsolateBinaryMessenger.ensureInitialized] for each
// background isolate that will use plugins. This sets up the
// [BinaryMessenger] that the Platform Channels will communicate with on
// the background isolate.
// ----------------------------------------------------------------------
BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken);
BackgroundIsolateBinaryMessenger.ensureInitialized(
rootIsolateToken);
_sendPort.send(const _Command(_Codes.ack, arg0: null));
case _Codes.add:
_doAddEntry(command.arg0 as String);

@ -7,7 +7,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
cupertino_icons: ^1.0.2

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
cupertino_icons: ^1.0.2

@ -5,7 +5,7 @@ publish_to: "none"
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
args: ^2.0.0

@ -4,7 +4,7 @@ version: 1.0.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
freezed_annotation: ">=2.1.0 <4.0.0"

@ -5,7 +5,7 @@ publish_to: none
version: 0.1.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: ^3.9.0-0
dependencies:
cached_network_image: ^3.4.1

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0
environment:
sdk: '>=3.9.0-0 <4.0.0'
sdk: ^3.9.0-0
dependencies:
args: ^2.4.0

@ -22,7 +22,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

@ -5,7 +5,7 @@ version: 0.1.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -22,7 +22,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
built_collection: ^5.1.1

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
built_collection: ^5.1.1

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -8,7 +8,7 @@ publish_to: 'none'
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ publish_to: 'none'
version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -6,7 +6,7 @@ resolution: workspace
version: 1.0.0+1
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ publish_to: none
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -7,7 +7,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
adaptive_navigation: ^0.0.3

@ -22,7 +22,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

@ -5,7 +5,7 @@ publish_to: none
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
english_words: ^4.0.0

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -6,7 +6,7 @@ version: 1.0.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -2,7 +2,7 @@ name: samples
description: A collection of samples for Dart and Flutter.
environment:
sdk: '^3.5.0'
sdk: ^3.9.0-0
workspace:
- add_to_app/android_view/flutter_module_using_plugin

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
auto_size_text: ^3.0.0

@ -20,7 +20,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions

@ -4,7 +4,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -1,7 +1,7 @@
name: release_cleaner
description: A tool to automate release cleanup for the samples monorepo.
environment:
sdk: '>=3.0.0 <4.0.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
args: ^2.4.2

@ -91,14 +91,14 @@ void setupLogging() {
logsDir.createSync(recursive: true);
}
final timestamp = DateTime.now().toIso8601String().replaceAll(':', '-');
_logFile = File(p.join(logDir, 'flutter_update_$timestamp.log'));
_logFile = File(p.join(logDir, 'release_logs_$timestamp.log'));
}
void log(String? message, IOSink sink) {
if (message == null) return;
sink.writeln(message);
_logFile.writeAsStringSync(
'${overrideAnsiOutput(false, () => message)}\n',
resetAll.wrap('$message\n')!,
mode: FileMode.append,
);
}
@ -207,9 +207,7 @@ Future<bool> updateSdkConstraints(
}
try {
final version = Version.parse(versionString);
final nextMajor = version.major + 1;
final newConstraint = "'>=${version} <$nextMajor.0.0'";
final newConstraint = '^${versionString}-0';
final content = await pubspecFile.readAsString();
final editor = YamlEditor(content);

@ -5,7 +5,7 @@ version: 1.2.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0+1
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -5,7 +5,7 @@ version: 1.0.0
resolution: workspace
environment:
sdk: '^3.5.0'
sdk: '>=3.9.0 <4.0.0'
dependencies:
flutter:

@ -1,6 +1,8 @@
You are a Dart developer that maintains packages. Your current task is to incrementally update monorepos to use pub workspaces.
You are a Dart developer that maintains this monorepo of Flutter sample projects.
- Read https://dart.dev/tools/pub/workspaces
- Create a gloabl pubspec.yaml and populate it
- Determine 5 packages in this repository that could easily be migrated to workspaces.
- Migrate those 5 packages.

Loading…
Cancel
Save