checkin - updated to workspace

pull/2701/head
Eric Windmill 1 month ago
parent ef2e8e71ee
commit b023fdabcb

1
.gitignore vendored

@ -27,6 +27,7 @@
.pub-cache/ .pub-cache/
.pub/ .pub/
/build/ /build/
**/build/
# Android related # Android related
**/gradle-wrapper.jar **/gradle-wrapper.jar

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

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

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

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

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

@ -1,3 +1,4 @@
# https://dart.dev/guides/libraries/private-files # https://dart.dev/guides/libraries/private-files
# Created by `dart pub` # Created by `dart pub`
.dart_tool/ .dart_tool/
.build/

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

@ -44,8 +44,11 @@ class Demo {
final String route; final String route;
final WidgetBuilder builder; final WidgetBuilder builder;
const Demo( const Demo({
{required this.name, required this.route, required this.builder}); required this.name,
required this.route,
required this.builder,
});
} }
final basicDemos = [ final basicDemos = [

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

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

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

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

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

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

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

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

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

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

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

@ -30,7 +30,8 @@ class Grid extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return (index >= 20) return (index >= 20)
? const SmallCard( ? const SmallCard(
imageAssetName: 'assets/eat_cape_town_sm.jpg') imageAssetName: 'assets/eat_cape_town_sm.jpg',
)
: const SmallCard( : const SmallCard(
imageAssetName: 'assets/eat_new_orleans_sm.jpg', imageAssetName: 'assets/eat_new_orleans_sm.jpg',
); );
@ -52,7 +53,7 @@ Route _createRoute(BuildContext parentContext, String image) {
return Stack( return Stack(
children: [ children: [
PositionedTransition(rect: rectAnimation, child: child) PositionedTransition(rect: rectAnimation, child: child),
], ],
); );
}, },

@ -16,12 +16,16 @@ class HeroAnimationDemo extends StatelessWidget {
child: Hero( child: Hero(
tag: 'hero-page-child', tag: 'hero-page-child',
child: _createHeroContainer( child: _createHeroContainer(
size: 50.0, color: Colors.grey.shade300), size: 50.0,
color: Colors.grey.shade300,
),
), ),
onTap: () => Navigator.of( onTap: () =>
context, Navigator.of(
).push<void>( context,
MaterialPageRoute(builder: (context) => const HeroPage())), ).push<void>(
MaterialPageRoute(builder: (context) => const HeroPage()),
),
), ),
); );
} }

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

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

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

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

@ -24,7 +24,9 @@ void main() {
// The size of ExpandCard must change once tapped. // The size of ExpandCard must change once tapped.
// The initialSize should be less than current ExpandCard size. // The initialSize should be less than current ExpandCard size.
expect( expect(
initialSize, lessThan(tester.getSize(find.byType(ExpandCard)))); initialSize,
lessThan(tester.getSize(find.byType(ExpandCard))),
);
}); });
testWidgets('ExpandCard changes image on tap', (tester) async { testWidgets('ExpandCard changes image on tap', (tester) async {

@ -34,8 +34,9 @@ void main() {
expect(finalSize, greaterThan(initialSize)); expect(finalSize, greaterThan(initialSize));
}); });
testWidgets('Final inkwell on tap goes back to the grid', testWidgets('Final inkwell on tap goes back to the grid', (
(tester) async { tester,
) async {
await tester.pumpWidget(createFocusImageScreen()); await tester.pumpWidget(createFocusImageScreen());
// Tap on the ink well at index 0. // Tap on the ink well at index 0.

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

@ -1 +0,0 @@
include: package:flutter_lints/flutter.yaml

@ -13,6 +13,8 @@ dependencies:
vector_graphics: ^1.1.11+1 vector_graphics: ^1.1.11+1
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../analysis_defaults
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0

@ -67,10 +67,11 @@ class _MyHomePageState extends State<MyHomePage> {
// just for demonstration purposes. // just for demonstration purposes.
final Future<void> sharedPreferencesSet = final Future<void> sharedPreferencesSet =
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(sharedPreferences) => sharedPreferences.setBool('isDebug', true), (sharedPreferences) =>
); sharedPreferences.setBool('isDebug', true),
final Future<Directory> tempDirFuture = );
path_provider.getTemporaryDirectory(); final Future<Directory> tempDirFuture = path_provider
.getTemporaryDirectory();
// Wait until the [SharedPreferences] value is set and the temporary // Wait until the [SharedPreferences] value is set and the temporary
// directory is received before opening the database. If // directory is received before opening the database. If

@ -190,7 +190,8 @@ class _SimpleDatabaseServer {
// the background isolate. // the background isolate.
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
BackgroundIsolateBinaryMessenger.ensureInitialized( BackgroundIsolateBinaryMessenger.ensureInitialized(
rootIsolateToken); rootIsolateToken,
);
_sendPort.send(const _Command(_Codes.ack, arg0: null)); _sendPort.send(const _Command(_Codes.ack, arg0: null));
case _Codes.add: case _Codes.add:
_doAddEntry(command.arg0 as String); _doAddEntry(command.arg0 as String);

@ -16,6 +16,8 @@ dependencies:
path: ../shared path: ../shared
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../../analysis_defaults
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter

@ -15,6 +15,8 @@ dependencies:
path: ../shared path: ../shared
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../../analysis_defaults
http: ^1.0.0 http: ^1.0.0
lints: ^6.0.0 lints: ^6.0.0
test: ^1.15.0 test: ^1.15.0

@ -11,6 +11,8 @@ dependencies:
json_annotation: ^4.7.0 json_annotation: ^4.7.0
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../../analysis_defaults
build_runner: ^2.2.1 build_runner: ^2.2.1
freezed: ">=2.1.1 <4.0.0" freezed: ">=2.1.1 <4.0.0"
json_serializable: ^6.4.0 json_serializable: ^6.4.0

@ -3,6 +3,7 @@ description: >-
A sample app that helps users build and book itineraries for trips. A sample app that helps users build and book itineraries for trips.
publish_to: none publish_to: none
version: 0.1.0 version: 0.1.0
resolution: workspace
environment: environment:
sdk: ^3.9.0-0 sdk: ^3.9.0-0
@ -15,7 +16,7 @@ dependencies:
sdk: flutter sdk: flutter
flutter_svg: ^2.0.16 flutter_svg: ^2.0.16
freezed_annotation: ^2.4.4 freezed_annotation: ^2.4.4
go_router: ^14.6.2 go_router: ^16.0.0
google_fonts: ^6.2.1 google_fonts: ^6.2.1
intl: any intl: any
json_annotation: ^4.9.0 json_annotation: ^4.9.0
@ -25,15 +26,16 @@ dependencies:
shared_preferences: ^2.3.5 shared_preferences: ^2.3.5
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../../analysis_defaults
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^5.0.0
mocktail_image_network: ^1.2.0 mocktail_image_network: ^1.2.0
mocktail: ^1.0.4 mocktail: ^1.0.4
integration_test: integration_test:
sdk: flutter sdk: flutter
build_runner: ^2.4.14 build_runner: ^2.4.14
freezed: ^2.5.7 freezed: ^3.0.0
json_serializable: ^6.9.0 json_serializable: ^6.9.0
flutter: flutter:

@ -11,7 +11,8 @@
# (the recommended set includes the core lints). # (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages. # The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml include: package:analysis_defaults/flutter.yaml
# Uncomment the following section to specify additional rules. # Uncomment the following section to specify additional rules.

@ -2,6 +2,7 @@ name: compass_server
description: A server app using the shelf package and Docker. description: A server app using the shelf package and Docker.
publish_to: 'none' publish_to: 'none'
version: 1.0.0 version: 1.0.0
resolution: workspace
environment: environment:
sdk: ^3.9.0-0 sdk: ^3.9.0-0
@ -15,7 +16,8 @@ dependencies:
dev_dependencies: dev_dependencies:
http: ^1.1.0 http: ^1.1.0
lints: ^5.0.0 analysis_defaults:
path: ../../analysis_defaults
test: ^1.24.0 test: ^1.24.0
build_runner: ^2.4.11 build_runner: ^2.4.11
freezed: ^2.5.7 freezed: ^2.5.7

@ -112,7 +112,9 @@ class _MyContextMenuRegionState extends State<_MyContextMenuRegion> {
), ),
), ),
Text( Text(
_lastSelection != null ? 'Last Selected: $_lastSelection' : '', _lastSelection != null
? 'Last Selected: $_lastSelection'
: '',
), ),
], ],
), ),
@ -228,7 +230,10 @@ class _MyCascadingContextMenuState extends State<_MyCascadingContextMenu> {
); );
widget.onToggleMessageVisibility(); widget.onToggleMessageVisibility();
}, },
shortcut: const SingleActivator(LogicalKeyboardKey.keyS, control: true), shortcut: const SingleActivator(
LogicalKeyboardKey.keyS,
control: true,
),
), ),
// Hides the message, but is only enabled if the message isn't // Hides the message, but is only enabled if the message isn't
// already hidden. // already hidden.

@ -28,7 +28,8 @@ class ContextMenuRegion extends StatefulWidget {
class _ContextMenuRegionState extends State<ContextMenuRegion> { class _ContextMenuRegionState extends State<ContextMenuRegion> {
Offset? _longPressOffset; Offset? _longPressOffset;
final ContextMenuController _contextMenuController = ContextMenuController(); final ContextMenuController _contextMenuController =
ContextMenuController();
static bool get _longPressEnabled { static bool get _longPressEnabled {
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {

@ -62,7 +62,11 @@ class DefaultValuesPage extends StatelessWidget {
'This example simply shows what happens when contextMenuBuilder is given null, a custom value, or omitted altogether.', 'This example simply shows what happens when contextMenuBuilder is given null, a custom value, or omitted altogether.',
), ),
const SizedBox(height: 40.0), const SizedBox(height: 40.0),
TextField(maxLines: 2, minLines: 2, controller: _controllerNone), TextField(
maxLines: 2,
minLines: 2,
controller: _controllerNone,
),
TextField( TextField(
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,

@ -63,7 +63,9 @@ class EmailButtonPage extends StatelessWidget {
editableTextState.textEditingValue; editableTextState.textEditingValue;
final List<ContextMenuButtonItem> buttonItems = final List<ContextMenuButtonItem> buttonItems =
editableTextState.contextMenuButtonItems; editableTextState.contextMenuButtonItems;
if (isValidEmail(value.selection.textInside(value.text))) { if (isValidEmail(
value.selection.textInside(value.text),
)) {
buttonItems.insert( buttonItems.insert(
0, 0,
ContextMenuButtonItem( ContextMenuButtonItem(

@ -26,16 +26,17 @@ class FieldTypesPage extends StatelessWidget {
"CupertinoTextField can't show Material menus by default. On non-Apple platforms, you'll still see a Cupertino menu here.", "CupertinoTextField can't show Material menus by default. On non-Apple platforms, you'll still see a Cupertino menu here.",
); );
final TextEditingController _cupertinoControllerFixed = TextEditingController( final TextEditingController
_cupertinoControllerFixed = TextEditingController(
text: text:
"But CupertinoTextField can be made to adaptively show any menu. You'll see the correct menu for your platform here.", "But CupertinoTextField can be made to adaptively show any menu. You'll see the correct menu for your platform here.",
); );
final TextEditingController _cupertinoControllerForced = final TextEditingController
TextEditingController( _cupertinoControllerForced = TextEditingController(
text: text:
'Or forced to always show a specific menu (Material desktop menu).', 'Or forced to always show a specific menu (Material desktop menu).',
); );
final TextEditingController _editableController = TextEditingController( final TextEditingController _editableController = TextEditingController(
text: text:
@ -67,7 +68,10 @@ class FieldTypesPage extends StatelessWidget {
const SizedBox(height: 20.0), const SizedBox(height: 20.0),
TextField(maxLines: 3, controller: _controller), TextField(maxLines: 3, controller: _controller),
const SizedBox(height: 60.0), const SizedBox(height: 60.0),
CupertinoTextField(maxLines: 3, controller: _cupertinoController), CupertinoTextField(
maxLines: 3,
controller: _cupertinoController,
),
const SizedBox(height: 20.0), const SizedBox(height: 20.0),
CupertinoTextField( CupertinoTextField(
maxLines: 3, maxLines: 3,
@ -84,11 +88,13 @@ class FieldTypesPage extends StatelessWidget {
controller: _cupertinoControllerForced, controller: _cupertinoControllerForced,
contextMenuBuilder: (context, editableTextState) { contextMenuBuilder: (context, editableTextState) {
return DesktopTextSelectionToolbar( return DesktopTextSelectionToolbar(
anchor: editableTextState.contextMenuAnchors.primaryAnchor, anchor:
children: AdaptiveTextSelectionToolbar.getAdaptiveButtons( editableTextState.contextMenuAnchors.primaryAnchor,
context, children:
editableTextState.contextMenuButtonItems, AdaptiveTextSelectionToolbar.getAdaptiveButtons(
).toList(), context,
editableTextState.contextMenuButtonItems,
).toList(),
); );
}, },
), ),

@ -107,7 +107,9 @@ class FullPage extends StatelessWidget {
editableTextState.textEditingValue; editableTextState.textEditingValue;
final List<ContextMenuButtonItem> buttonItems = final List<ContextMenuButtonItem> buttonItems =
editableTextState.contextMenuButtonItems; editableTextState.contextMenuButtonItems;
if (isValidEmail(value.selection.textInside(value.text))) { if (isValidEmail(
value.selection.textInside(value.text),
)) {
buttonItems.insert( buttonItems.insert(
0, 0,
ContextMenuButtonItem( ContextMenuButtonItem(
@ -115,7 +117,10 @@ class FullPage extends StatelessWidget {
onPressed: () { onPressed: () {
ContextMenuController.removeAny(); ContextMenuController.removeAny();
Navigator.of(context).push( Navigator.of(context).push(
_showDialog(context, 'You clicked send email'), _showDialog(
context,
'You clicked send email',
),
); );
}, },
), ),

@ -9,7 +9,8 @@ class GlobalSelectionPage extends StatelessWidget {
static const String route = 'global-selection'; static const String route = 'global-selection';
static const String title = 'Global Selection Example'; static const String title = 'Global Selection Example';
static const String subtitle = 'Context menus in and out of global selection'; static const String subtitle =
'Context menus in and out of global selection';
static const String url = '$kCodeUrl/global_selection_page.dart'; static const String url = '$kCodeUrl/global_selection_page.dart';
final PlatformCallback onChangedPlatform; final PlatformCallback onChangedPlatform;

@ -19,8 +19,9 @@ class ImagePage extends StatelessWidget {
DialogRoute _showDialog(BuildContext context) { DialogRoute _showDialog(BuildContext context) {
return DialogRoute<void>( return DialogRoute<void>(
context: context, context: context,
builder: (context) => builder: (context) => const AlertDialog(
const AlertDialog(title: Text('Image saved! (not really though)')), title: Text('Image saved! (not really though)'),
),
); );
} }
@ -47,7 +48,9 @@ class ImagePage extends StatelessWidget {
ContextMenuRegion( ContextMenuRegion(
contextMenuBuilder: (context, offset) { contextMenuBuilder: (context, offset) {
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: TextSelectionToolbarAnchors(primaryAnchor: offset), anchors: TextSelectionToolbarAnchors(
primaryAnchor: offset,
),
buttonItems: <ContextMenuButtonItem>[ buttonItems: <ContextMenuButtonItem>[
ContextMenuButtonItem( ContextMenuButtonItem(
onPressed: () { onPressed: () {

@ -13,7 +13,8 @@ class PlatformSelector extends StatefulWidget {
} }
class _PlatformSelectorState extends State<PlatformSelector> { class _PlatformSelectorState extends State<PlatformSelector> {
static const int targetPlatformStringLength = 15; // 'TargetPlatform.'.length static const int targetPlatformStringLength =
15; // 'TargetPlatform.'.length
static String _platformToString(TargetPlatform platform) { static String _platformToString(TargetPlatform platform) {
return platform.toString().substring(targetPlatformStringLength); return platform.toString().substring(targetPlatformStringLength);

@ -11,7 +11,8 @@ class ReorderedButtonsPage extends StatelessWidget {
static const String route = 'reordered-buttons'; static const String route = 'reordered-buttons';
static const String title = 'Reordered Buttons'; static const String title = 'Reordered Buttons';
static const String subtitle = 'The usual buttons, but in a different order.'; static const String subtitle =
'The usual buttons, but in a different order.';
static const String url = '$kCodeUrl/reordered_buttons_page.dart'; static const String url = '$kCodeUrl/reordered_buttons_page.dart';
final PlatformCallback onChangedPlatform; final PlatformCallback onChangedPlatform;
@ -54,26 +55,38 @@ class ReorderedButtonsPage extends StatelessWidget {
maxLines: 2, maxLines: 2,
contextMenuBuilder: (context, editableTextState) { contextMenuBuilder: (context, editableTextState) {
// Reorder the button datas by type. // Reorder the button datas by type.
final HashMap<ContextMenuButtonType, ContextMenuButtonItem> final HashMap<
ContextMenuButtonType,
ContextMenuButtonItem
>
buttonItemsMap = buttonItemsMap =
HashMap<ContextMenuButtonType, ContextMenuButtonItem>(); HashMap<
ContextMenuButtonType,
ContextMenuButtonItem
>();
for (ContextMenuButtonItem buttonItem for (ContextMenuButtonItem buttonItem
in editableTextState.contextMenuButtonItems) { in editableTextState.contextMenuButtonItems) {
buttonItemsMap[buttonItem.type] = buttonItem; buttonItemsMap[buttonItem.type] = buttonItem;
} }
final List<ContextMenuButtonItem> final List<ContextMenuButtonItem> reorderedButtonItems =
reorderedButtonItems = <ContextMenuButtonItem>[ <ContextMenuButtonItem>[
if (buttonItemsMap.containsKey( if (buttonItemsMap.containsKey(
ContextMenuButtonType.selectAll, ContextMenuButtonType.selectAll,
)) ))
buttonItemsMap[ContextMenuButtonType.selectAll]!, buttonItemsMap[ContextMenuButtonType.selectAll]!,
if (buttonItemsMap.containsKey(ContextMenuButtonType.paste)) if (buttonItemsMap.containsKey(
buttonItemsMap[ContextMenuButtonType.paste]!, ContextMenuButtonType.paste,
if (buttonItemsMap.containsKey(ContextMenuButtonType.copy)) ))
buttonItemsMap[ContextMenuButtonType.copy]!, buttonItemsMap[ContextMenuButtonType.paste]!,
if (buttonItemsMap.containsKey(ContextMenuButtonType.cut)) if (buttonItemsMap.containsKey(
buttonItemsMap[ContextMenuButtonType.cut]!, ContextMenuButtonType.copy,
]; ))
buttonItemsMap[ContextMenuButtonType.copy]!,
if (buttonItemsMap.containsKey(
ContextMenuButtonType.cut,
))
buttonItemsMap[ContextMenuButtonType.cut]!,
];
return AdaptiveTextSelectionToolbar.buttonItems( return AdaptiveTextSelectionToolbar.buttonItems(
anchors: editableTextState.contextMenuAnchors, anchors: editableTextState.contextMenuAnchors,
buttonItems: reorderedButtonItems, buttonItems: reorderedButtonItems,

@ -37,7 +37,10 @@ void main() {
expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
expect(find.byType(CupertinoTextSelectionToolbarButton), findsNothing); expect(
find.byType(CupertinoTextSelectionToolbarButton),
findsNothing,
);
expect(find.byType(CupertinoButton), findsNWidgets(2)); expect(find.byType(CupertinoButton), findsNWidgets(2));
case TargetPlatform.macOS: case TargetPlatform.macOS:
expect(find.byType(CupertinoButton), findsNWidgets(2)); expect(find.byType(CupertinoButton), findsNWidgets(2));
@ -52,7 +55,10 @@ void main() {
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
expect(find.byType(CupertinoButton), findsNWidgets(1)); expect(find.byType(CupertinoButton), findsNWidgets(1));
expect(find.byType(DesktopTextSelectionToolbarButton), findsNothing); expect(
find.byType(DesktopTextSelectionToolbarButton),
findsNothing,
);
} }
}); });
} }

@ -7,7 +7,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Shows default buttons in a custom context menu', (tester) async { testWidgets('Shows default buttons in a custom context menu', (
tester,
) async {
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(const MyApp());
// Navigate to the CustomMenuPage example. // Navigate to the CustomMenuPage example.
@ -33,7 +35,10 @@ void main() {
// A custom context menu is shown, and the buttons are the default ones. // A custom context menu is shown, and the buttons are the default ones.
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
expect(find.byType(CupertinoAdaptiveTextSelectionToolbar), findsNothing); expect(
find.byType(CupertinoAdaptiveTextSelectionToolbar),
findsNothing,
);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
expect( expect(
@ -47,7 +52,10 @@ void main() {
); );
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(find.byType(TextSelectionToolbarTextButton), findsNWidgets(1)); expect(
find.byType(TextSelectionToolbarTextButton),
findsNWidgets(1),
);
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
expect( expect(

@ -55,7 +55,10 @@ void main() {
); );
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(find.byType(TextSelectionToolbarTextButton), findsNWidgets(1)); expect(
find.byType(TextSelectionToolbarTextButton),
findsNWidgets(1),
);
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
expect( expect(

@ -61,7 +61,10 @@ void main() {
); );
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(find.byType(TextSelectionToolbarTextButton), findsNWidgets(3)); expect(
find.byType(TextSelectionToolbarTextButton),
findsNWidgets(3),
);
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
expect( expect(
@ -111,7 +114,10 @@ void main() {
); );
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(find.byType(TextSelectionToolbarTextButton), findsNWidgets(4)); expect(
find.byType(TextSelectionToolbarTextButton),
findsNWidgets(4),
);
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
expect( expect(

@ -44,7 +44,10 @@ void main() {
expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
expect(find.byType(CupertinoTextSelectionToolbar), findsOneWidget); expect(
find.byType(CupertinoTextSelectionToolbar),
findsOneWidget,
);
case TargetPlatform.android: case TargetPlatform.android:
expect(find.byType(TextSelectionToolbar), findsOneWidget); expect(find.byType(TextSelectionToolbar), findsOneWidget);
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
@ -83,7 +86,10 @@ void main() {
case TargetPlatform.iOS: case TargetPlatform.iOS:
case TargetPlatform.android: case TargetPlatform.android:
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
expect(find.byType(CupertinoTextSelectionToolbar), findsOneWidget); expect(
find.byType(CupertinoTextSelectionToolbar),
findsOneWidget,
);
case TargetPlatform.macOS: case TargetPlatform.macOS:
case TargetPlatform.linux: case TargetPlatform.linux:
case TargetPlatform.windows: case TargetPlatform.windows:
@ -96,7 +102,10 @@ void main() {
// Tap the next field to hide the context menu. // Tap the next field to hide the context menu.
await tester.tap(find.byType(CupertinoTextField).at(1)); await tester.tap(find.byType(CupertinoTextField).at(1));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(CupertinoAdaptiveTextSelectionToolbar), findsNothing); expect(
find.byType(CupertinoAdaptiveTextSelectionToolbar),
findsNothing,
);
// Right click on the fixed CupertinoTextField. // Right click on the fixed CupertinoTextField.
gesture = await tester.startGesture( gesture = await tester.startGesture(
@ -113,7 +122,10 @@ void main() {
expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
expect(find.byType(CupertinoTextSelectionToolbar), findsOneWidget); expect(
find.byType(CupertinoTextSelectionToolbar),
findsOneWidget,
);
case TargetPlatform.android: case TargetPlatform.android:
expect(find.byType(TextSelectionToolbar), findsOneWidget); expect(find.byType(TextSelectionToolbar), findsOneWidget);
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:
@ -145,7 +157,10 @@ void main() {
// The DesktopTextSelectionToolbar is shown for all platforms. // The DesktopTextSelectionToolbar is shown for all platforms.
expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing); expect(find.byType(AdaptiveTextSelectionToolbar), findsNothing);
expect(find.byType(CupertinoAdaptiveTextSelectionToolbar), findsNothing); expect(
find.byType(CupertinoAdaptiveTextSelectionToolbar),
findsNothing,
);
expect(find.byType(DesktopTextSelectionToolbar), findsOneWidget); expect(find.byType(DesktopTextSelectionToolbar), findsOneWidget);
// Tap the next field to hide the context menu. // Tap the next field to hide the context menu.
@ -168,7 +183,10 @@ void main() {
expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget);
switch (defaultTargetPlatform) { switch (defaultTargetPlatform) {
case TargetPlatform.iOS: case TargetPlatform.iOS:
expect(find.byType(CupertinoTextSelectionToolbar), findsOneWidget); expect(
find.byType(CupertinoTextSelectionToolbar),
findsOneWidget,
);
case TargetPlatform.android: case TargetPlatform.android:
expect(find.byType(TextSelectionToolbar), findsOneWidget); expect(find.byType(TextSelectionToolbar), findsOneWidget);
case TargetPlatform.fuchsia: case TargetPlatform.fuchsia:

@ -5,43 +5,49 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('Gives correct behavior for all values of contextMenuBuilder', ( testWidgets(
tester, 'Gives correct behavior for all values of contextMenuBuilder',
) async { (
await tester.pumpWidget(const MyApp()); tester,
) async {
await tester.pumpWidget(const MyApp());
// Navigate to the GlobalSelectionPage example. // Navigate to the GlobalSelectionPage example.
await tester.dragUntilVisible( await tester.dragUntilVisible(
find.text(GlobalSelectionPage.title), find.text(GlobalSelectionPage.title),
find.byType(ListView), find.byType(ListView),
const Offset(0.0, -100.0), const Offset(0.0, -100.0),
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.text(GlobalSelectionPage.title)); await tester.tap(find.text(GlobalSelectionPage.title));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect( expect(
find.descendant( find.descendant(
of: find.byType(AppBar), of: find.byType(AppBar),
matching: find.text(GlobalSelectionPage.title), matching: find.text(GlobalSelectionPage.title),
), ),
findsOneWidget, findsOneWidget,
); );
// Right click on the plain Text widget. // Right click on the plain Text widget.
TestGesture gesture = await tester.startGesture( TestGesture gesture = await tester.startGesture(
tester.getCenter( tester.getCenter(
find.descendant(of: find.byType(ListView), matching: find.byType(Text)), find.descendant(
), of: find.byType(ListView),
kind: PointerDeviceKind.mouse, matching: find.byType(Text),
buttons: kSecondaryMouseButton, ),
); ),
await tester.pump(); kind: PointerDeviceKind.mouse,
await gesture.up(); buttons: kSecondaryMouseButton,
await gesture.removePointer(); );
await tester.pumpAndSettle(); await tester.pump();
await gesture.up();
await gesture.removePointer();
await tester.pumpAndSettle();
// The default context menu is shown with a custom button. // The default context menu is shown with a custom button.
expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget); expect(find.byType(AdaptiveTextSelectionToolbar), findsOneWidget);
expect(find.text('Back'), findsOneWidget); expect(find.text('Back'), findsOneWidget);
}); },
);
} }

@ -40,6 +40,9 @@ List<TextSelectionPoint> globalize(
RenderBox box, RenderBox box,
) { ) {
return points.map<TextSelectionPoint>((point) { return points.map<TextSelectionPoint>((point) {
return TextSelectionPoint(box.localToGlobal(point.point), point.direction); return TextSelectionPoint(
box.localToGlobal(point.point),
point.direction,
);
}).toList(); }).toList();
} }

@ -55,9 +55,8 @@ class _EventDetailState extends State<EventDetail> {
Navigator.of(context) Navigator.of(context)
.push( .push(
CupertinoPageRoute<(IconData, ColorOptions)?>( CupertinoPageRoute<(IconData, ColorOptions)?>(
builder: builder: (_) =>
(_) => SymbolEditor(event.icon, event.color),
SymbolEditor(event.icon, event.color),
), ),
) )
.then(((IconData, ColorOptions)? data) { .then(((IconData, ColorOptions)? data) {

@ -41,22 +41,21 @@ class _EventEditorState extends State<EventEditor> {
// //
// Is this maybe the issue here? // Is this maybe the issue here?
// https://github.com/flutter/flutter/issues/91715 // https://github.com/flutter/flutter/issues/91715
leading: leading: isNew
isNew ? CupertinoButton(
? CupertinoButton( padding: EdgeInsets.zero,
padding: EdgeInsets.zero, child: const Text('Cancel'),
child: const Text('Cancel'), onPressed: () => Navigator.pop(context, null),
onPressed: () => Navigator.pop(context, null), )
) : CupertinoButton(
: CupertinoButton( padding: EdgeInsets.zero,
padding: EdgeInsets.zero, onPressed: () {
onPressed: () { Navigator.pop(context, event);
Navigator.pop(context, event); },
}, child: const Row(
child: const Row( children: [Icon(CupertinoIcons.back), Text('Date Planner')],
children: [Icon(CupertinoIcons.back), Text('Date Planner')],
),
), ),
),
trailing: CupertinoButton( trailing: CupertinoButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: Text(isNew ? 'Add' : (isEditing ? 'Done' : 'Edit')), child: Text(isNew ? 'Add' : (isEditing ? 'Done' : 'Edit')),

@ -36,11 +36,10 @@ class EventList extends StatelessWidget {
// Blocked on https://github.com/flutter/flutter/issues/42560. // Blocked on https://github.com/flutter/flutter/issues/42560.
Event? newEvent = await Navigator.of(context).push( Event? newEvent = await Navigator.of(context).push(
CupertinoPageRoute<Event>( CupertinoPageRoute<Event>(
builder: builder: (_) => EventEditor(
(_) => EventEditor( event: Event(title: 'New event'),
event: Event(title: 'New event'), isNew: true,
isNew: true, ),
),
), ),
); );
@ -69,17 +68,15 @@ class EventList extends StatelessWidget {
EventRow( EventRow(
event: e, event: e,
onTap: () async { onTap: () async {
Event? updatedEvent = await Navigator.of( Event? updatedEvent = await Navigator.of(context)
context, .push(
).push( CupertinoPageRoute<Event>(
CupertinoPageRoute<Event>( builder: (_) => EventEditor(
builder:
(_) => EventEditor(
event: e.copy(), event: e.copy(),
isNew: false, isNew: false,
), ),
), ),
); );
if (updatedEvent == null) { if (updatedEvent == null) {
// The editor passes back null when it deleted // The editor passes back null when it deleted
// the element. // the element.

@ -31,9 +31,9 @@ class EventRow extends StatelessWidget {
event.isComplete event.isComplete
? const Icon(CupertinoIcons.check_mark) ? const Icon(CupertinoIcons.check_mark)
: Text( : Text(
'${event.remainingTaskCount}', '${event.remainingTaskCount}',
style: const TextStyle(color: CupertinoColors.systemGrey), style: const TextStyle(color: CupertinoColors.systemGrey),
), ),
const CupertinoListTileChevron(), const CupertinoListTileChevron(),
], ],
), ),

@ -39,11 +39,8 @@ class _SymbolEditorState extends State<SymbolEditor> {
CupertinoButton( CupertinoButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: const Text('Done'), child: const Text('Done'),
onPressed: onPressed: () =>
() => Navigator.pop(context, ( Navigator.pop(context, (_currentIcon, _currentColor)),
_currentIcon,
_currentColor,
)),
), ),
], ],
), ),

@ -29,14 +29,13 @@ class _TaskRowState extends State<TaskRow> {
return Row( return Row(
children: [ children: [
CupertinoButton( CupertinoButton(
onPressed: onPressed: widget.isEditing
widget.isEditing ? () {
? () { setState(() {
setState(() { widget.task.isCompleted = !widget.task.isCompleted;
widget.task.isCompleted = !widget.task.isCompleted; });
}); }
} : null,
: null,
child: Icon( child: Icon(
widget.task.isCompleted widget.task.isCompleted
? CupertinoIcons.checkmark_circle_fill ? CupertinoIcons.checkmark_circle_fill
@ -45,15 +44,14 @@ class _TaskRowState extends State<TaskRow> {
), ),
), ),
Expanded( Expanded(
child: child: widget.isEditing
widget.isEditing ? CupertinoTextField(
? CupertinoTextField( decoration: null,
decoration: null, padding: EdgeInsets.zero,
padding: EdgeInsets.zero, controller: _taskText,
controller: _taskText, onChanged: (value) => widget.task.text = value,
onChanged: (value) => widget.task.text = value, )
) : Text(widget.task.text),
: Text(widget.task.text),
), ),
], ],
); );

@ -16,4 +16,6 @@ dependencies:
uuid: uuid:
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../analysis_defaults
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0

@ -41,6 +41,8 @@ dependencies:
go_router: ^16.0.0 go_router: ^16.0.0
dev_dependencies: dev_dependencies:
analysis_defaults:
path: ../analysis_defaults
flutter_test: flutter_test:
sdk: flutter sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to # The "flutter_lints" package below contains a set of recommended lints to

@ -24,7 +24,9 @@ void main() {
Logger.root.level = Level.ALL; Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((rec) { Logger.root.onRecord.listen((rec) {
// ignore: avoid_print // ignore: avoid_print
print('${rec.loggerName} ${rec.level.name}: ${rec.time}: ${rec.message}'); print(
'${rec.loggerName} ${rec.level.name}: ${rec.time}: ${rec.message}',
);
}); });
if (unsplashAccessKey.isEmpty) { if (unsplashAccessKey.isEmpty) {
@ -50,7 +52,8 @@ const double windowWidth = 1024;
const double windowHeight = 800; const double windowHeight = 800;
void setupWindow() { void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { if (!kIsWeb &&
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMinSize(const Size(windowWidth, windowHeight));
} }
@ -84,8 +87,9 @@ class UnsplashHomePage extends StatelessWidget {
onSelected: () { onSelected: () {
showDialog<void>( showDialog<void>(
context: context, context: context,
builder: (context) => builder: (context) => PhotoSearchDialog(
PhotoSearchDialog(callback: photoSearchModel.addSearch), callback: photoSearchModel.addSearch,
),
); );
}, },
), ),

@ -45,5 +45,6 @@ class PhotoSearchModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<Uint8List> download({required Photo photo}) => _client.download(photo); Future<Uint8List> download({required Photo photo}) =>
_client.download(photo);
} }

@ -33,7 +33,9 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
'results', 'results',
serializers.serialize( serializers.serialize(
object.results, object.results,
specifiedType: const FullType(BuiltList, const [const FullType(Photo)]), specifiedType: const FullType(BuiltList, const [
const FullType(Photo),
]),
), ),
]; ];
@ -104,7 +106,9 @@ class _$Search extends Search {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(other, this)) return true; if (identical(other, this)) return true;
return other is Search && query == other.query && results == other.results; return other is Search &&
query == other.query &&
results == other.results;
} }
@override @override

@ -21,7 +21,9 @@ abstract class ApiError implements Built<ApiError, ApiErrorBuilder> {
BuiltList<String>? get errors; BuiltList<String>? get errors;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(ApiError.serializer, this)); return json.encode(
serializers.serializeWith(ApiError.serializer, this),
);
} }
static ApiError? fromJson(String jsonString) { static ApiError? fromJson(String jsonString) {

@ -12,7 +12,8 @@ import '../serializers.dart';
part 'current_user_collections.g.dart'; part 'current_user_collections.g.dart';
abstract class CurrentUserCollections abstract class CurrentUserCollections
implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements
Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
factory CurrentUserCollections([ factory CurrentUserCollections([
void Function(CurrentUserCollectionsBuilder)? updates, void Function(CurrentUserCollectionsBuilder)? updates,
]) = _$CurrentUserCollections; ]) = _$CurrentUserCollections;

@ -39,7 +39,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('title') ..add('title')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.publishedAt; value = object.publishedAt;
@ -47,7 +50,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('published_at') ..add('published_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.updatedAt; value = object.updatedAt;
@ -55,7 +61,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('updated_at') ..add('updated_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;
@ -134,7 +143,11 @@ class _$CurrentUserCollections extends CurrentUserCollections {
this.publishedAt, this.publishedAt,
this.updatedAt, this.updatedAt,
}) : super._() { }) : super._() {
BuiltValueNullFieldError.checkNotNull(id, r'CurrentUserCollections', 'id'); BuiltValueNullFieldError.checkNotNull(
id,
r'CurrentUserCollections',
'id',
);
} }
@override @override
@ -179,7 +192,8 @@ class _$CurrentUserCollections extends CurrentUserCollections {
} }
class CurrentUserCollectionsBuilder class CurrentUserCollectionsBuilder
implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements
Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
_$CurrentUserCollections? _$v; _$CurrentUserCollections? _$v;
int? _id; int? _id;
@ -192,7 +206,8 @@ class CurrentUserCollectionsBuilder
String? _publishedAt; String? _publishedAt;
String? get publishedAt => _$this._publishedAt; String? get publishedAt => _$this._publishedAt;
set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt; set publishedAt(String? publishedAt) =>
_$this._publishedAt = publishedAt;
String? _updatedAt; String? _updatedAt;
String? get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;

@ -31,7 +31,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('make') ..add('make')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.model; value = object.model;
@ -39,7 +42,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('model') ..add('model')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.exposureTime; value = object.exposureTime;
@ -47,7 +53,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('exposure_time') ..add('exposure_time')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.aperture; value = object.aperture;
@ -55,7 +64,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('aperture') ..add('aperture')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.focalLength; value = object.focalLength;
@ -63,14 +75,19 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('focal_length') ..add('focal_length')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.iso; value = object.iso;
if (value != null) { if (value != null) {
result result
..add('iso') ..add('iso')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
return result; return result;
} }
@ -131,7 +148,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
break; break;
case 'iso': case 'iso':
result.iso = result.iso =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
} }
@ -225,7 +245,8 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _exposureTime; String? _exposureTime;
String? get exposureTime => _$this._exposureTime; String? get exposureTime => _$this._exposureTime;
set exposureTime(String? exposureTime) => _$this._exposureTime = exposureTime; set exposureTime(String? exposureTime) =>
_$this._exposureTime = exposureTime;
String? _aperture; String? _aperture;
String? get aperture => _$this._aperture; String? get aperture => _$this._aperture;
@ -233,7 +254,8 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _focalLength; String? _focalLength;
String? get focalLength => _$this._focalLength; String? get focalLength => _$this._focalLength;
set focalLength(String? focalLength) => _$this._focalLength = focalLength; set focalLength(String? focalLength) =>
_$this._focalLength = focalLength;
int? _iso; int? _iso;
int? get iso => _$this._iso; int? get iso => _$this._iso;

@ -31,7 +31,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('self') ..add('self')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.html; value = object.html;
@ -39,7 +42,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('html') ..add('html')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.download; value = object.download;
@ -47,7 +53,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('download') ..add('download')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.downloadLocation; value = object.downloadLocation;
@ -55,7 +64,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('download_location') ..add('download_location')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;

@ -27,7 +27,9 @@ abstract class Location implements Built<Location, LocationBuilder> {
Position? get position; Position? get position;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Location.serializer, this)); return json.encode(
serializers.serializeWith(Location.serializer, this),
);
} }
static Location? fromJson(String jsonString) { static Location? fromJson(String jsonString) {

@ -31,7 +31,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('city') ..add('city')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.country; value = object.country;
@ -39,7 +42,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('country') ..add('country')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.position; value = object.position;
@ -47,7 +53,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('position') ..add('position')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Position)), serializers.serialize(
value,
specifiedType: const FullType(Position),
),
); );
} }
return result; return result;
@ -160,7 +169,8 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
set country(String? country) => _$this._country = country; set country(String? country) => _$this._country = country;
PositionBuilder? _position; PositionBuilder? _position;
PositionBuilder get position => _$this._position ??= new PositionBuilder(); PositionBuilder get position =>
_$this._position ??= new PositionBuilder();
set position(PositionBuilder? position) => _$this._position = position; set position(PositionBuilder? position) => _$this._position = position;
LocationBuilder(); LocationBuilder();

@ -26,7 +26,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
}) { }) {
final result = <Object?>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(
object.id,
specifiedType: const FullType(String),
),
]; ];
Object? value; Object? value;
value = object.createdAt; value = object.createdAt;
@ -34,7 +37,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('created_at') ..add('created_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.updatedAt; value = object.updatedAt;
@ -42,47 +48,64 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('updated_at') ..add('updated_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.width; value = object.width;
if (value != null) { if (value != null) {
result result
..add('width') ..add('width')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.height; value = object.height;
if (value != null) { if (value != null) {
result result
..add('height') ..add('height')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.color; value = object.color;
if (value != null) { if (value != null) {
result result
..add('color') ..add('color')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.downloads; value = object.downloads;
if (value != null) { if (value != null) {
result result
..add('downloads') ..add('downloads')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.likes; value = object.likes;
if (value != null) { if (value != null) {
result result
..add('likes') ..add('likes')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.likedByUser; value = object.likedByUser;
if (value != null) { if (value != null) {
result result
..add('liked_by_user') ..add('liked_by_user')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(bool)), serializers.serialize(
value,
specifiedType: const FullType(bool),
),
); );
} }
value = object.description; value = object.description;
@ -90,7 +113,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('description') ..add('description')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.exif; value = object.exif;
@ -98,7 +124,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('exif') ..add('exif')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Exif)), serializers.serialize(
value,
specifiedType: const FullType(Exif),
),
); );
} }
value = object.location; value = object.location;
@ -106,7 +135,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('location') ..add('location')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Location)), serializers.serialize(
value,
specifiedType: const FullType(Location),
),
); );
} }
value = object.tags; value = object.tags;
@ -140,7 +172,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('urls') ..add('urls')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Urls)), serializers.serialize(
value,
specifiedType: const FullType(Urls),
),
); );
} }
value = object.links; value = object.links;
@ -148,7 +183,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('links') ..add('links')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Links)), serializers.serialize(
value,
specifiedType: const FullType(Links),
),
); );
} }
value = object.user; value = object.user;
@ -156,7 +194,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('user') ..add('user')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(User)), serializers.serialize(
value,
specifiedType: const FullType(User),
),
); );
} }
return result; return result;
@ -202,12 +243,18 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'width': case 'width':
result.width = result.width =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'height': case 'height':
result.height = result.height =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'color': case 'color':
@ -220,12 +267,18 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'downloads': case 'downloads':
result.downloads = result.downloads =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'likes': case 'likes':
result.likes = result.likes =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'liked_by_user': case 'liked_by_user':
@ -246,7 +299,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'exif': case 'exif':
result.exif.replace( result.exif.replace(
serializers.deserialize(value, specifiedType: const FullType(Exif))! serializers.deserialize(
value,
specifiedType: const FullType(Exif),
)!
as Exif, as Exif,
); );
break; break;
@ -283,7 +339,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'urls': case 'urls':
result.urls.replace( result.urls.replace(
serializers.deserialize(value, specifiedType: const FullType(Urls))! serializers.deserialize(
value,
specifiedType: const FullType(Urls),
)!
as Urls, as Urls,
); );
break; break;
@ -298,7 +357,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'user': case 'user':
result.user.replace( result.user.replace(
serializers.deserialize(value, specifiedType: const FullType(User))! serializers.deserialize(
value,
specifiedType: const FullType(User),
)!
as User, as User,
); );
break; break;
@ -489,14 +551,16 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
String? _description; String? _description;
String? get description => _$this._description; String? get description => _$this._description;
set description(String? description) => _$this._description = description; set description(String? description) =>
_$this._description = description;
ExifBuilder? _exif; ExifBuilder? _exif;
ExifBuilder get exif => _$this._exif ??= new ExifBuilder(); ExifBuilder get exif => _$this._exif ??= new ExifBuilder();
set exif(ExifBuilder? exif) => _$this._exif = exif; set exif(ExifBuilder? exif) => _$this._exif = exif;
LocationBuilder? _location; LocationBuilder? _location;
LocationBuilder get location => _$this._location ??= new LocationBuilder(); LocationBuilder get location =>
_$this._location ??= new LocationBuilder();
set location(LocationBuilder? location) => _$this._location = location; set location(LocationBuilder? location) => _$this._location = location;
ListBuilder<Tags>? _tags; ListBuilder<Tags>? _tags;

@ -23,7 +23,9 @@ abstract class Position implements Built<Position, PositionBuilder> {
double get longitude; double get longitude;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Position.serializer, this)); return json.encode(
serializers.serializeWith(Position.serializer, this),
);
} }
static Position? fromJson(String jsonString) { static Position? fromJson(String jsonString) {

@ -86,9 +86,18 @@ class _$Position extends Position {
factory _$Position([void Function(PositionBuilder)? updates]) => factory _$Position([void Function(PositionBuilder)? updates]) =>
(new PositionBuilder()..update(updates))._build(); (new PositionBuilder()..update(updates))._build();
_$Position._({required this.latitude, required this.longitude}) : super._() { _$Position._({required this.latitude, required this.longitude})
BuiltValueNullFieldError.checkNotNull(latitude, r'Position', 'latitude'); : super._() {
BuiltValueNullFieldError.checkNotNull(longitude, r'Position', 'longitude'); BuiltValueNullFieldError.checkNotNull(
latitude,
r'Position',
'latitude',
);
BuiltValueNullFieldError.checkNotNull(
longitude,
r'Position',
'longitude',
);
} }
@override @override

@ -33,7 +33,9 @@ class _$SearchPhotosResponseSerializer
'results', 'results',
serializers.serialize( serializers.serialize(
object.results, object.results,
specifiedType: const FullType(BuiltList, const [const FullType(Photo)]), specifiedType: const FullType(BuiltList, const [
const FullType(Photo),
]),
), ),
]; ];
Object? value; Object? value;
@ -41,13 +43,17 @@ class _$SearchPhotosResponseSerializer
if (value != null) { if (value != null) {
result result
..add('total') ..add('total')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.totalPages; value = object.totalPages;
if (value != null) { if (value != null) {
result result
..add('total_pages') ..add('total_pages')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
return result; return result;
} }
@ -68,12 +74,18 @@ class _$SearchPhotosResponseSerializer
switch (key) { switch (key) {
case 'total': case 'total':
result.total = result.total =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'total_pages': case 'total_pages':
result.totalPages = result.totalPages =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'results': case 'results':
@ -106,8 +118,11 @@ class _$SearchPhotosResponse extends SearchPhotosResponse {
void Function(SearchPhotosResponseBuilder)? updates, void Function(SearchPhotosResponseBuilder)? updates,
]) => (new SearchPhotosResponseBuilder()..update(updates))._build(); ]) => (new SearchPhotosResponseBuilder()..update(updates))._build();
_$SearchPhotosResponse._({this.total, this.totalPages, required this.results}) _$SearchPhotosResponse._({
: super._() { this.total,
this.totalPages,
required this.results,
}) : super._() {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
results, results,
r'SearchPhotosResponse', r'SearchPhotosResponse',

@ -140,7 +140,11 @@ class TagsBuilder implements Builder<Tags, TagsBuilder> {
final _$result = final _$result =
_$v ?? _$v ??
new _$Tags._( new _$Tags._(
title: BuiltValueNullFieldError.checkNotNull(title, r'Tags', 'title'), title: BuiltValueNullFieldError.checkNotNull(
title,
r'Tags',
'title',
),
); );
replace(_$result); replace(_$result);
return _$result; return _$result;

@ -31,7 +31,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('raw') ..add('raw')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.full; value = object.full;
@ -39,7 +42,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('full') ..add('full')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.regular; value = object.regular;
@ -47,7 +53,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('regular') ..add('regular')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.small; value = object.small;
@ -55,7 +64,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('small') ..add('small')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.thumb; value = object.thumb;
@ -63,7 +75,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('thumb') ..add('thumb')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;

@ -26,14 +26,20 @@ class _$UserSerializer implements StructuredSerializer<User> {
}) { }) {
final result = <Object?>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(
object.id,
specifiedType: const FullType(String),
),
'username', 'username',
serializers.serialize( serializers.serialize(
object.username, object.username,
specifiedType: const FullType(String), specifiedType: const FullType(String),
), ),
'name', 'name',
serializers.serialize(object.name, specifiedType: const FullType(String)), serializers.serialize(
object.name,
specifiedType: const FullType(String),
),
]; ];
Object? value; Object? value;
value = object.updatedAt; value = object.updatedAt;
@ -41,7 +47,10 @@ class _$UserSerializer implements StructuredSerializer<User> {
result result
..add('updated_at') ..add('updated_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.portfolioUrl; value = object.portfolioUrl;
@ -49,7 +58,10 @@ class _$UserSerializer implements StructuredSerializer<User> {
result result
..add('portfolio_url') ..add('portfolio_url')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.bio; value = object.bio;
@ -57,7 +69,10 @@ class _$UserSerializer implements StructuredSerializer<User> {
result result
..add('bio') ..add('bio')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.location; value = object.location;
@ -65,33 +80,45 @@ class _$UserSerializer implements StructuredSerializer<User> {
result result
..add('location') ..add('location')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.totalLikes; value = object.totalLikes;
if (value != null) { if (value != null) {
result result
..add('total_likes') ..add('total_likes')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.totalPhotos; value = object.totalPhotos;
if (value != null) { if (value != null) {
result result
..add('total_photos') ..add('total_photos')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.totalCollections; value = object.totalCollections;
if (value != null) { if (value != null) {
result result
..add('total_collections') ..add('total_collections')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.links; value = object.links;
if (value != null) { if (value != null) {
result result
..add('links') ..add('links')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Links)), serializers.serialize(
value,
specifiedType: const FullType(Links),
),
); );
} }
return result; return result;
@ -169,17 +196,26 @@ class _$UserSerializer implements StructuredSerializer<User> {
break; break;
case 'total_likes': case 'total_likes':
result.totalLikes = result.totalLikes =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'total_photos': case 'total_photos':
result.totalPhotos = result.totalPhotos =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'total_collections': case 'total_collections':
result.totalCollections = result.totalCollections =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'links': case 'links':
@ -324,7 +360,8 @@ class UserBuilder implements Builder<User, UserBuilder> {
String? _portfolioUrl; String? _portfolioUrl;
String? get portfolioUrl => _$this._portfolioUrl; String? get portfolioUrl => _$this._portfolioUrl;
set portfolioUrl(String? portfolioUrl) => _$this._portfolioUrl = portfolioUrl; set portfolioUrl(String? portfolioUrl) =>
_$this._portfolioUrl = portfolioUrl;
String? _bio; String? _bio;
String? get bio => _$this._bio; String? get bio => _$this._bio;
@ -399,7 +436,11 @@ class UserBuilder implements Builder<User, UserBuilder> {
r'User', r'User',
'username', 'username',
), ),
name: BuiltValueNullFieldError.checkNotNull(name, r'User', 'name'), name: BuiltValueNullFieldError.checkNotNull(
name,
r'User',
'name',
),
portfolioUrl: portfolioUrl, portfolioUrl: portfolioUrl,
bio: bio, bio: bio,
location: location, location: location,

@ -115,7 +115,9 @@ class _SplitState extends State<Split> {
secondSize = secondSize - halfDivider; secondSize = secondSize - halfDivider;
void updateSpacing(DragUpdateDetails dragDetails) { void updateSpacing(DragUpdateDetails dragDetails) {
final delta = isHorizontal ? dragDetails.delta.dx : dragDetails.delta.dy; final delta = isHorizontal
? dragDetails.delta.dx
: dragDetails.delta.dy;
final fractionalDelta = delta / axisSize; final fractionalDelta = delta / axisSize;
setState(() { setState(() {
// Update the fraction of space consumed by the children, // Update the fraction of space consumed by the children,
@ -144,11 +146,17 @@ class _SplitState extends State<Split> {
child: DecoratedBox( child: DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).dividerColor, color: Theme.of(context).dividerColor,
borderRadius: BorderRadius.circular(Split.dividerMainAxisSize), borderRadius: BorderRadius.circular(
Split.dividerMainAxisSize,
),
), ),
child: SizedBox( child: SizedBox(
height: isHorizontal ? 2.0 : Split.dividerMainAxisSize - 2.0, height: isHorizontal
width: isHorizontal ? Split.dividerMainAxisSize - 2.0 : 2.0, ? 2.0
: Split.dividerMainAxisSize - 2.0,
width: isHorizontal
? Split.dividerMainAxisSize - 2.0
: 2.0,
), ),
), ),
), ),

@ -15,7 +15,8 @@ class UnsplashSearchContent extends StatefulWidget {
const UnsplashSearchContent({super.key}); const UnsplashSearchContent({super.key});
@override @override
State<UnsplashSearchContent> createState() => _UnsplashSearchContentState(); State<UnsplashSearchContent> createState() =>
_UnsplashSearchContentState();
} }
class _UnsplashSearchContentState extends State<UnsplashSearchContent> { class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
@ -39,7 +40,9 @@ class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
child: SingleChildScrollView( child: SingleChildScrollView(
controller: _treeViewScrollController, controller: _treeViewScrollController,
child: TreeView( child: TreeView(
items: photoSearchModel.entries.map(_buildSearchEntry).toList(), items: photoSearchModel.entries
.map(_buildSearchEntry)
.toList(),
), ),
), ),
), ),

@ -44,7 +44,8 @@ Future<void> test() async =>
_logProcessOutput(Process.start('flutter', ['test'])); _logProcessOutput(Process.start('flutter', ['test']));
@Task() @Task()
Future<void> clean() => _logProcessOutput(Process.start('flutter', ['clean'])); Future<void> clean() =>
_logProcessOutput(Process.start('flutter', ['clean']));
Future<void> _logProcessOutput(Future<Process> proc) async { Future<void> _logProcessOutput(Future<Process> proc) async {
final process = await proc; final process = await proc;

@ -24,7 +24,9 @@ void main() {
Logger.root.level = Level.ALL; Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((rec) { Logger.root.onRecord.listen((rec) {
// ignore: avoid_print // ignore: avoid_print
print('${rec.loggerName} ${rec.level.name}: ${rec.time}: ${rec.message}'); print(
'${rec.loggerName} ${rec.level.name}: ${rec.time}: ${rec.message}',
);
}); });
if (unsplashAccessKey.isEmpty) { if (unsplashAccessKey.isEmpty) {
@ -50,7 +52,8 @@ const double windowWidth = 1024;
const double windowHeight = 800; const double windowHeight = 800;
void setupWindow() { void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { if (!kIsWeb &&
(Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
setWindowMinSize(const Size(windowWidth, windowHeight)); setWindowMinSize(const Size(windowWidth, windowHeight));
} }
@ -85,8 +88,9 @@ class UnsplashHomePage extends StatelessWidget {
onSelected: () { onSelected: () {
showDialog<void>( showDialog<void>(
context: context, context: context,
builder: (context) => builder: (context) => PhotoSearchDialog(
PhotoSearchDialog(callback: photoSearchModel.addSearch), callback: photoSearchModel.addSearch,
),
); );
}, },
), ),

@ -45,5 +45,6 @@ class PhotoSearchModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<Uint8List> download({required Photo photo}) => _client.download(photo); Future<Uint8List> download({required Photo photo}) =>
_client.download(photo);
} }

@ -33,7 +33,9 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
'results', 'results',
serializers.serialize( serializers.serialize(
object.results, object.results,
specifiedType: const FullType(BuiltList, const [const FullType(Photo)]), specifiedType: const FullType(BuiltList, const [
const FullType(Photo),
]),
), ),
]; ];
@ -104,7 +106,9 @@ class _$Search extends Search {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(other, this)) return true; if (identical(other, this)) return true;
return other is Search && query == other.query && results == other.results; return other is Search &&
query == other.query &&
results == other.results;
} }
@override @override

@ -21,7 +21,9 @@ abstract class ApiError implements Built<ApiError, ApiErrorBuilder> {
BuiltList<String>? get errors; BuiltList<String>? get errors;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(ApiError.serializer, this)); return json.encode(
serializers.serializeWith(ApiError.serializer, this),
);
} }
static ApiError? fromJson(String jsonString) { static ApiError? fromJson(String jsonString) {

@ -12,7 +12,8 @@ import '../serializers.dart';
part 'current_user_collections.g.dart'; part 'current_user_collections.g.dart';
abstract class CurrentUserCollections abstract class CurrentUserCollections
implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements
Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
factory CurrentUserCollections([ factory CurrentUserCollections([
void Function(CurrentUserCollectionsBuilder)? updates, void Function(CurrentUserCollectionsBuilder)? updates,
]) = _$CurrentUserCollections; ]) = _$CurrentUserCollections;

@ -39,7 +39,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('title') ..add('title')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.publishedAt; value = object.publishedAt;
@ -47,7 +50,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('published_at') ..add('published_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.updatedAt; value = object.updatedAt;
@ -55,7 +61,10 @@ class _$CurrentUserCollectionsSerializer
result result
..add('updated_at') ..add('updated_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;
@ -134,7 +143,11 @@ class _$CurrentUserCollections extends CurrentUserCollections {
this.publishedAt, this.publishedAt,
this.updatedAt, this.updatedAt,
}) : super._() { }) : super._() {
BuiltValueNullFieldError.checkNotNull(id, r'CurrentUserCollections', 'id'); BuiltValueNullFieldError.checkNotNull(
id,
r'CurrentUserCollections',
'id',
);
} }
@override @override
@ -179,7 +192,8 @@ class _$CurrentUserCollections extends CurrentUserCollections {
} }
class CurrentUserCollectionsBuilder class CurrentUserCollectionsBuilder
implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements
Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
_$CurrentUserCollections? _$v; _$CurrentUserCollections? _$v;
int? _id; int? _id;
@ -192,7 +206,8 @@ class CurrentUserCollectionsBuilder
String? _publishedAt; String? _publishedAt;
String? get publishedAt => _$this._publishedAt; String? get publishedAt => _$this._publishedAt;
set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt; set publishedAt(String? publishedAt) =>
_$this._publishedAt = publishedAt;
String? _updatedAt; String? _updatedAt;
String? get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;

@ -31,7 +31,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('make') ..add('make')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.model; value = object.model;
@ -39,7 +42,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('model') ..add('model')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.exposureTime; value = object.exposureTime;
@ -47,7 +53,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('exposure_time') ..add('exposure_time')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.aperture; value = object.aperture;
@ -55,7 +64,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('aperture') ..add('aperture')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.focalLength; value = object.focalLength;
@ -63,14 +75,19 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
result result
..add('focal_length') ..add('focal_length')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.iso; value = object.iso;
if (value != null) { if (value != null) {
result result
..add('iso') ..add('iso')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
return result; return result;
} }
@ -131,7 +148,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
break; break;
case 'iso': case 'iso':
result.iso = result.iso =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
} }
@ -225,7 +245,8 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _exposureTime; String? _exposureTime;
String? get exposureTime => _$this._exposureTime; String? get exposureTime => _$this._exposureTime;
set exposureTime(String? exposureTime) => _$this._exposureTime = exposureTime; set exposureTime(String? exposureTime) =>
_$this._exposureTime = exposureTime;
String? _aperture; String? _aperture;
String? get aperture => _$this._aperture; String? get aperture => _$this._aperture;
@ -233,7 +254,8 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
String? _focalLength; String? _focalLength;
String? get focalLength => _$this._focalLength; String? get focalLength => _$this._focalLength;
set focalLength(String? focalLength) => _$this._focalLength = focalLength; set focalLength(String? focalLength) =>
_$this._focalLength = focalLength;
int? _iso; int? _iso;
int? get iso => _$this._iso; int? get iso => _$this._iso;

@ -31,7 +31,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('self') ..add('self')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.html; value = object.html;
@ -39,7 +42,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('html') ..add('html')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.download; value = object.download;
@ -47,7 +53,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('download') ..add('download')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.downloadLocation; value = object.downloadLocation;
@ -55,7 +64,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
result result
..add('download_location') ..add('download_location')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;

@ -27,7 +27,9 @@ abstract class Location implements Built<Location, LocationBuilder> {
Position? get position; Position? get position;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Location.serializer, this)); return json.encode(
serializers.serializeWith(Location.serializer, this),
);
} }
static Location? fromJson(String jsonString) { static Location? fromJson(String jsonString) {

@ -31,7 +31,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('city') ..add('city')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.country; value = object.country;
@ -39,7 +42,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('country') ..add('country')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.position; value = object.position;
@ -47,7 +53,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
result result
..add('position') ..add('position')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Position)), serializers.serialize(
value,
specifiedType: const FullType(Position),
),
); );
} }
return result; return result;
@ -160,7 +169,8 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
set country(String? country) => _$this._country = country; set country(String? country) => _$this._country = country;
PositionBuilder? _position; PositionBuilder? _position;
PositionBuilder get position => _$this._position ??= new PositionBuilder(); PositionBuilder get position =>
_$this._position ??= new PositionBuilder();
set position(PositionBuilder? position) => _$this._position = position; set position(PositionBuilder? position) => _$this._position = position;
LocationBuilder(); LocationBuilder();

@ -26,7 +26,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
}) { }) {
final result = <Object?>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(
object.id,
specifiedType: const FullType(String),
),
]; ];
Object? value; Object? value;
value = object.createdAt; value = object.createdAt;
@ -34,7 +37,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('created_at') ..add('created_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.updatedAt; value = object.updatedAt;
@ -42,47 +48,64 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('updated_at') ..add('updated_at')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.width; value = object.width;
if (value != null) { if (value != null) {
result result
..add('width') ..add('width')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.height; value = object.height;
if (value != null) { if (value != null) {
result result
..add('height') ..add('height')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.color; value = object.color;
if (value != null) { if (value != null) {
result result
..add('color') ..add('color')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.downloads; value = object.downloads;
if (value != null) { if (value != null) {
result result
..add('downloads') ..add('downloads')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.likes; value = object.likes;
if (value != null) { if (value != null) {
result result
..add('likes') ..add('likes')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.likedByUser; value = object.likedByUser;
if (value != null) { if (value != null) {
result result
..add('liked_by_user') ..add('liked_by_user')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(bool)), serializers.serialize(
value,
specifiedType: const FullType(bool),
),
); );
} }
value = object.description; value = object.description;
@ -90,7 +113,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('description') ..add('description')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.exif; value = object.exif;
@ -98,7 +124,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('exif') ..add('exif')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Exif)), serializers.serialize(
value,
specifiedType: const FullType(Exif),
),
); );
} }
value = object.location; value = object.location;
@ -106,7 +135,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('location') ..add('location')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Location)), serializers.serialize(
value,
specifiedType: const FullType(Location),
),
); );
} }
value = object.tags; value = object.tags;
@ -140,7 +172,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('urls') ..add('urls')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Urls)), serializers.serialize(
value,
specifiedType: const FullType(Urls),
),
); );
} }
value = object.links; value = object.links;
@ -148,7 +183,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('links') ..add('links')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(Links)), serializers.serialize(
value,
specifiedType: const FullType(Links),
),
); );
} }
value = object.user; value = object.user;
@ -156,7 +194,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
result result
..add('user') ..add('user')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(User)), serializers.serialize(
value,
specifiedType: const FullType(User),
),
); );
} }
return result; return result;
@ -202,12 +243,18 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'width': case 'width':
result.width = result.width =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'height': case 'height':
result.height = result.height =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'color': case 'color':
@ -220,12 +267,18 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'downloads': case 'downloads':
result.downloads = result.downloads =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'likes': case 'likes':
result.likes = result.likes =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'liked_by_user': case 'liked_by_user':
@ -246,7 +299,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'exif': case 'exif':
result.exif.replace( result.exif.replace(
serializers.deserialize(value, specifiedType: const FullType(Exif))! serializers.deserialize(
value,
specifiedType: const FullType(Exif),
)!
as Exif, as Exif,
); );
break; break;
@ -283,7 +339,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'urls': case 'urls':
result.urls.replace( result.urls.replace(
serializers.deserialize(value, specifiedType: const FullType(Urls))! serializers.deserialize(
value,
specifiedType: const FullType(Urls),
)!
as Urls, as Urls,
); );
break; break;
@ -298,7 +357,10 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'user': case 'user':
result.user.replace( result.user.replace(
serializers.deserialize(value, specifiedType: const FullType(User))! serializers.deserialize(
value,
specifiedType: const FullType(User),
)!
as User, as User,
); );
break; break;
@ -489,14 +551,16 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
String? _description; String? _description;
String? get description => _$this._description; String? get description => _$this._description;
set description(String? description) => _$this._description = description; set description(String? description) =>
_$this._description = description;
ExifBuilder? _exif; ExifBuilder? _exif;
ExifBuilder get exif => _$this._exif ??= new ExifBuilder(); ExifBuilder get exif => _$this._exif ??= new ExifBuilder();
set exif(ExifBuilder? exif) => _$this._exif = exif; set exif(ExifBuilder? exif) => _$this._exif = exif;
LocationBuilder? _location; LocationBuilder? _location;
LocationBuilder get location => _$this._location ??= new LocationBuilder(); LocationBuilder get location =>
_$this._location ??= new LocationBuilder();
set location(LocationBuilder? location) => _$this._location = location; set location(LocationBuilder? location) => _$this._location = location;
ListBuilder<Tags>? _tags; ListBuilder<Tags>? _tags;

@ -23,7 +23,9 @@ abstract class Position implements Built<Position, PositionBuilder> {
double get longitude; double get longitude;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Position.serializer, this)); return json.encode(
serializers.serializeWith(Position.serializer, this),
);
} }
static Position? fromJson(String jsonString) { static Position? fromJson(String jsonString) {

@ -86,9 +86,18 @@ class _$Position extends Position {
factory _$Position([void Function(PositionBuilder)? updates]) => factory _$Position([void Function(PositionBuilder)? updates]) =>
(new PositionBuilder()..update(updates))._build(); (new PositionBuilder()..update(updates))._build();
_$Position._({required this.latitude, required this.longitude}) : super._() { _$Position._({required this.latitude, required this.longitude})
BuiltValueNullFieldError.checkNotNull(latitude, r'Position', 'latitude'); : super._() {
BuiltValueNullFieldError.checkNotNull(longitude, r'Position', 'longitude'); BuiltValueNullFieldError.checkNotNull(
latitude,
r'Position',
'latitude',
);
BuiltValueNullFieldError.checkNotNull(
longitude,
r'Position',
'longitude',
);
} }
@override @override

@ -33,7 +33,9 @@ class _$SearchPhotosResponseSerializer
'results', 'results',
serializers.serialize( serializers.serialize(
object.results, object.results,
specifiedType: const FullType(BuiltList, const [const FullType(Photo)]), specifiedType: const FullType(BuiltList, const [
const FullType(Photo),
]),
), ),
]; ];
Object? value; Object? value;
@ -41,13 +43,17 @@ class _$SearchPhotosResponseSerializer
if (value != null) { if (value != null) {
result result
..add('total') ..add('total')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
value = object.totalPages; value = object.totalPages;
if (value != null) { if (value != null) {
result result
..add('total_pages') ..add('total_pages')
..add(serializers.serialize(value, specifiedType: const FullType(int))); ..add(
serializers.serialize(value, specifiedType: const FullType(int)),
);
} }
return result; return result;
} }
@ -68,12 +74,18 @@ class _$SearchPhotosResponseSerializer
switch (key) { switch (key) {
case 'total': case 'total':
result.total = result.total =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'total_pages': case 'total_pages':
result.totalPages = result.totalPages =
serializers.deserialize(value, specifiedType: const FullType(int)) serializers.deserialize(
value,
specifiedType: const FullType(int),
)
as int?; as int?;
break; break;
case 'results': case 'results':
@ -106,8 +118,11 @@ class _$SearchPhotosResponse extends SearchPhotosResponse {
void Function(SearchPhotosResponseBuilder)? updates, void Function(SearchPhotosResponseBuilder)? updates,
]) => (new SearchPhotosResponseBuilder()..update(updates))._build(); ]) => (new SearchPhotosResponseBuilder()..update(updates))._build();
_$SearchPhotosResponse._({this.total, this.totalPages, required this.results}) _$SearchPhotosResponse._({
: super._() { this.total,
this.totalPages,
required this.results,
}) : super._() {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
results, results,
r'SearchPhotosResponse', r'SearchPhotosResponse',

@ -140,7 +140,11 @@ class TagsBuilder implements Builder<Tags, TagsBuilder> {
final _$result = final _$result =
_$v ?? _$v ??
new _$Tags._( new _$Tags._(
title: BuiltValueNullFieldError.checkNotNull(title, r'Tags', 'title'), title: BuiltValueNullFieldError.checkNotNull(
title,
r'Tags',
'title',
),
); );
replace(_$result); replace(_$result);
return _$result; return _$result;

@ -31,7 +31,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('raw') ..add('raw')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.full; value = object.full;
@ -39,7 +42,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('full') ..add('full')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.regular; value = object.regular;
@ -47,7 +53,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('regular') ..add('regular')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.small; value = object.small;
@ -55,7 +64,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('small') ..add('small')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
value = object.thumb; value = object.thumb;
@ -63,7 +75,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
result result
..add('thumb') ..add('thumb')
..add( ..add(
serializers.serialize(value, specifiedType: const FullType(String)), serializers.serialize(
value,
specifiedType: const FullType(String),
),
); );
} }
return result; return result;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save