mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,15 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
file_names: false
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -151,7 +151,7 @@ class HomePage extends StatelessWidget {
|
||||
final headerStyle = Theme.of(context).textTheme.headline6;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Animation Samples'),
|
||||
title: const Text('Animation Samples'),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
@@ -168,7 +168,7 @@ class HomePage extends StatelessWidget {
|
||||
class DemoTile extends StatelessWidget {
|
||||
final Demo demo;
|
||||
|
||||
DemoTile(this.demo);
|
||||
const DemoTile(this.demo);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -49,13 +49,13 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
|
||||
// and shrinking cards.
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('AnimatedContainer'),
|
||||
title: const Text('AnimatedContainer'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SizedBox(
|
||||
width: 128,
|
||||
height: 128,
|
||||
@@ -70,7 +70,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'change',
|
||||
),
|
||||
onPressed: () => change(),
|
||||
|
||||
@@ -11,11 +11,11 @@ class PageRouteBuilderDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Page 1'),
|
||||
title: const Text('Page 1'),
|
||||
),
|
||||
body: Center(
|
||||
child: ElevatedButton(
|
||||
child: Text('Go!'),
|
||||
child: const Text('Go!'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).push<void>(_createRoute());
|
||||
},
|
||||
@@ -29,7 +29,8 @@ Route _createRoute() {
|
||||
return PageRouteBuilder<SlideTransition>(
|
||||
pageBuilder: (context, animation, secondaryAnimation) => _Page2(),
|
||||
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
||||
var tween = Tween<Offset>(begin: Offset(0.0, 1.0), end: Offset.zero);
|
||||
var tween =
|
||||
Tween<Offset>(begin: const Offset(0.0, 1.0), end: Offset.zero);
|
||||
var curveTween = CurveTween(curve: Curves.ease);
|
||||
|
||||
return SlideTransition(
|
||||
@@ -45,7 +46,7 @@ class _Page2 extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Page 2'),
|
||||
title: const Text('Page 2'),
|
||||
),
|
||||
body: Center(
|
||||
child: Text('Page 2!', style: Theme.of(context).textTheme.headline4),
|
||||
|
||||
@@ -54,22 +54,22 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
|
||||
// has completed.
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Animation Controller'),
|
||||
title: const Text('Animation Controller'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 200),
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
child: Text(
|
||||
'${controller.value.toStringAsFixed(2)}',
|
||||
controller.value.toStringAsFixed(2),
|
||||
style: Theme.of(context).textTheme.headline3,
|
||||
textScaleFactor: 1 + controller.value,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text('animate'),
|
||||
child: const Text('animate'),
|
||||
onPressed: () {
|
||||
if (controller.status == AnimationStatus.completed) {
|
||||
controller.reverse();
|
||||
|
||||
@@ -40,16 +40,16 @@ class _TweenDemoState extends State<TweenDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Tweens'),
|
||||
title: const Text('Tweens'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 200),
|
||||
constraints: const BoxConstraints(maxWidth: 200),
|
||||
child: Text('\$${animation.value.toStringAsFixed(2)}',
|
||||
style: TextStyle(fontSize: 24)),
|
||||
style: const TextStyle(fontSize: 24)),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(
|
||||
|
||||
@@ -15,7 +15,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
|
||||
with SingleTickerProviderStateMixin {
|
||||
static const Color beginColor = Colors.deepPurple;
|
||||
static const Color endColor = Colors.deepOrange;
|
||||
Duration duration = Duration(milliseconds: 800);
|
||||
Duration duration = const Duration(milliseconds: 800);
|
||||
late AnimationController controller;
|
||||
late Animation<Color?> animation;
|
||||
|
||||
@@ -38,7 +38,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('AnimatedBuilder'),
|
||||
title: const Text('AnimatedBuilder'),
|
||||
),
|
||||
body: Center(
|
||||
// AnimatedBuilder handles listening to a given animation and calling the builder
|
||||
@@ -66,7 +66,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
|
||||
// if there is a non-animated Widget contained within the animated widget.
|
||||
// This can improve performance since this widget doesn't need to be rebuilt
|
||||
// when the animation changes.
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'Change Color',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
|
||||
@@ -47,7 +47,7 @@ class _CustomTweenDemoState extends State<CustomTweenDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Custom Tween'),
|
||||
title: const Text('Custom Tween'),
|
||||
actions: [
|
||||
MaterialButton(
|
||||
child: Text(
|
||||
@@ -79,16 +79,18 @@ class _CustomTweenDemoState extends State<CustomTweenDemo>
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Card(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (context, child) {
|
||||
return Text('${animation.value}',
|
||||
style: TextStyle(
|
||||
fontSize: 16, fontFamily: 'SpecialElite'));
|
||||
return Text(
|
||||
animation.value,
|
||||
style: const TextStyle(
|
||||
fontSize: 16, fontFamily: 'SpecialElite'),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -60,7 +60,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Tween Sequences'),
|
||||
title: const Text('Tween Sequences'),
|
||||
),
|
||||
body: Center(
|
||||
child: AnimatedBuilder(
|
||||
@@ -75,7 +75,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: Text('Animate', style: TextStyle(color: Colors.white)),
|
||||
child: const Text('Animate', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 500),
|
||||
duration: const Duration(milliseconds: 500),
|
||||
);
|
||||
|
||||
_curve = CurvedAnimation(parent: _controller, curve: Curves.easeIn);
|
||||
@@ -45,7 +45,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
title: const Text(
|
||||
'Fade Transition',
|
||||
),
|
||||
),
|
||||
@@ -55,14 +55,14 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
|
||||
children: <Widget>[
|
||||
FadeTransition(
|
||||
opacity: _animation,
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
Icons.star,
|
||||
color: Colors.amber,
|
||||
size: 300,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text('animate'),
|
||||
child: const Text('animate'),
|
||||
onPressed: () => setState(() {
|
||||
_controller.animateTo(1.0).then<TickerFuture>(
|
||||
(value) => _controller.animateBack(0.0));
|
||||
|
||||
@@ -30,7 +30,7 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
|
||||
UserModel(++_maxIdValue, 'New', 'Person'),
|
||||
);
|
||||
_listKey.currentState!
|
||||
.insertItem(index, duration: Duration(milliseconds: 300));
|
||||
.insertItem(index, duration: const Duration(milliseconds: 300));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,17 +42,17 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
|
||||
index,
|
||||
(context, animation) {
|
||||
return FadeTransition(
|
||||
opacity:
|
||||
CurvedAnimation(parent: animation, curve: Interval(0.5, 1.0)),
|
||||
opacity: CurvedAnimation(
|
||||
parent: animation, curve: const Interval(0.5, 1.0)),
|
||||
child: SizeTransition(
|
||||
sizeFactor:
|
||||
CurvedAnimation(parent: animation, curve: Interval(0.0, 1.0)),
|
||||
sizeFactor: CurvedAnimation(
|
||||
parent: animation, curve: const Interval(0.0, 1.0)),
|
||||
axisAlignment: 0.0,
|
||||
child: _buildItem(user),
|
||||
),
|
||||
);
|
||||
},
|
||||
duration: Duration(milliseconds: 600),
|
||||
duration: const Duration(milliseconds: 600),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -62,11 +62,11 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
|
||||
key: ValueKey<UserModel>(user),
|
||||
title: Text(user.firstName),
|
||||
subtitle: Text(user.lastName),
|
||||
leading: CircleAvatar(
|
||||
leading: const CircleAvatar(
|
||||
child: Icon(Icons.person),
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.delete),
|
||||
icon: const Icon(Icons.delete),
|
||||
onPressed: () => deleteUser(user.id),
|
||||
),
|
||||
);
|
||||
@@ -76,10 +76,10 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('AnimatedList'),
|
||||
title: const Text('AnimatedList'),
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.add),
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: addUser,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -38,12 +38,12 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.of(context).size;
|
||||
final appBar = AppBar(title: Text('AnimatedPositioned'));
|
||||
final appBar = AppBar(title: const Text('AnimatedPositioned'));
|
||||
final topPadding = MediaQuery.of(context).padding.top;
|
||||
// AnimatedPositioned animates changes to a widget's position within a Stack
|
||||
return Scaffold(
|
||||
appBar: appBar,
|
||||
body: Container(
|
||||
body: SizedBox(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Stack(
|
||||
@@ -51,7 +51,7 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
|
||||
AnimatedPositioned(
|
||||
top: topPosition,
|
||||
left: leftPosition,
|
||||
duration: Duration(seconds: 1),
|
||||
duration: const Duration(seconds: 1),
|
||||
child: InkWell(
|
||||
onTap: () => changePosition(
|
||||
size.height -
|
||||
|
||||
@@ -44,7 +44,7 @@ class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('AnimatedSwitcher'),
|
||||
title: const Text('AnimatedSwitcher'),
|
||||
actions: [
|
||||
MaterialButton(
|
||||
onPressed: () => setState(
|
||||
@@ -63,7 +63,7 @@ class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {
|
||||
// with a given transition. You can change the transitions by using
|
||||
// transitionBuilder property.
|
||||
child: AnimatedSwitcher(
|
||||
duration: Duration(seconds: 1),
|
||||
duration: const Duration(seconds: 1),
|
||||
child: container,
|
||||
transitionBuilder: (child, animation) => ScaleTransition(
|
||||
child: child,
|
||||
|
||||
@@ -35,7 +35,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Card Swipe'),
|
||||
title: const Text('Card Swipe'),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
@@ -78,7 +78,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
|
||||
class Card extends StatelessWidget {
|
||||
final String imageAssetName;
|
||||
|
||||
Card(this.imageAssetName);
|
||||
const Card(this.imageAssetName);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -101,7 +101,7 @@ class SwipeableCard extends StatefulWidget {
|
||||
final String imageAssetName;
|
||||
final VoidCallback onSwiped;
|
||||
|
||||
SwipeableCard({
|
||||
const SwipeableCard({
|
||||
required this.onSwiped,
|
||||
required this.imageAssetName,
|
||||
});
|
||||
@@ -123,7 +123,7 @@ class _SwipeableCardState extends State<SwipeableCard>
|
||||
_controller = AnimationController.unbounded(vsync: this);
|
||||
_animation = _controller.drive(Tween<Offset>(
|
||||
begin: Offset.zero,
|
||||
end: Offset(1, 0),
|
||||
end: const Offset(1, 0),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -184,12 +184,13 @@ class _SwipeableCardState extends State<SwipeableCard>
|
||||
void _updateAnimation(double dragPosition) {
|
||||
_animation = _controller.drive(Tween<Offset>(
|
||||
begin: Offset.zero,
|
||||
end: _isSwipingLeft ? Offset(-1, 0) : Offset(1, 0),
|
||||
end: _isSwipingLeft ? const Offset(-1, 0) : const Offset(1, 0),
|
||||
));
|
||||
}
|
||||
|
||||
void _animate({double velocity = 0}) {
|
||||
var description = SpringDescription(mass: 50, stiffness: 1, damping: 1);
|
||||
var description =
|
||||
const SpringDescription(mass: 50, stiffness: 1, damping: 1);
|
||||
var simulation =
|
||||
SpringSimulation(description, _controller.value, 1, velocity);
|
||||
_controller.animateWith(simulation).then<void>((_) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class CarouselDemo extends StatelessWidget {
|
||||
Widget build(context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Carousel Demo'),
|
||||
title: const Text('Carousel Demo'),
|
||||
),
|
||||
body: Center(
|
||||
child: Padding(
|
||||
|
||||
@@ -25,7 +25,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
late final Animation<double> animationRotation;
|
||||
late final Animation<Offset> animationTranslation;
|
||||
static const _duration = Duration(seconds: 4);
|
||||
List<CurveChoice> curves = [
|
||||
List<CurveChoice> curves = const [
|
||||
CurveChoice(curve: Curves.bounceIn, name: 'Bounce In'),
|
||||
CurveChoice(curve: Curves.bounceOut, name: 'Bounce Out'),
|
||||
CurveChoice(curve: Curves.easeInCubic, name: 'Ease In Cubic'),
|
||||
@@ -69,8 +69,8 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
}
|
||||
});
|
||||
animationTranslation = Tween<Offset>(
|
||||
begin: Offset(-1, 0),
|
||||
end: Offset(1, 0),
|
||||
begin: const Offset(-1, 0),
|
||||
end: const Offset(1, 0),
|
||||
).animate(curvedAnimation)
|
||||
..addListener(() {
|
||||
setState(() {});
|
||||
@@ -86,11 +86,11 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Curved Animation'),
|
||||
title: const Text('Curved Animation'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.0),
|
||||
const SizedBox(height: 20.0),
|
||||
Text(
|
||||
'Select Curve for forward motion',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
@@ -110,7 +110,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
},
|
||||
value: selectedForwardCurve,
|
||||
),
|
||||
SizedBox(height: 15.0),
|
||||
const SizedBox(height: 15.0),
|
||||
Text(
|
||||
'Select Curve for reverse motion',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
@@ -130,32 +130,28 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
},
|
||||
value: selectedReverseCurve,
|
||||
),
|
||||
SizedBox(height: 35.0),
|
||||
const SizedBox(height: 35.0),
|
||||
Transform.rotate(
|
||||
angle: animationRotation.value,
|
||||
child: Center(
|
||||
child: Container(
|
||||
child: FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.0),
|
||||
FractionalTranslation(
|
||||
translation: animationTranslation.value,
|
||||
child: Container(
|
||||
child: const Center(
|
||||
child: FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25.0),
|
||||
const SizedBox(height: 35.0),
|
||||
FractionalTranslation(
|
||||
translation: animationTranslation.value,
|
||||
child: const FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25.0),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
controller.forward();
|
||||
},
|
||||
child: Text('Animate'),
|
||||
child: const Text('Animate'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -11,7 +11,7 @@ class ExpandCardDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Expandable Card'),
|
||||
title: const Text('Expandable Card'),
|
||||
),
|
||||
body: Center(
|
||||
child: ExpandCard(),
|
||||
|
||||
@@ -10,7 +10,7 @@ class FocusImageDemo extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Focus Image')),
|
||||
appBar: AppBar(title: const Text('Focus Image')),
|
||||
body: Grid(),
|
||||
);
|
||||
}
|
||||
@@ -23,11 +23,11 @@ class Grid extends StatelessWidget {
|
||||
body: GridView.builder(
|
||||
itemCount: 40,
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
|
||||
itemBuilder: (context, index) {
|
||||
return (index >= 20)
|
||||
? SmallCard('assets/eat_cape_town_sm.jpg')
|
||||
: SmallCard('assets/eat_new_orleans_sm.jpg');
|
||||
? const SmallCard('assets/eat_cape_town_sm.jpg')
|
||||
: const SmallCard('assets/eat_new_orleans_sm.jpg');
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -68,7 +68,7 @@ Tween<RelativeRect> _createTween(BuildContext context) {
|
||||
class SmallCard extends StatelessWidget {
|
||||
final String imageAssetName;
|
||||
|
||||
SmallCard(this.imageAssetName);
|
||||
const SmallCard(this.imageAssetName);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -92,7 +92,7 @@ class SmallCard extends StatelessWidget {
|
||||
class _SecondPage extends StatelessWidget {
|
||||
final String imageAssetName;
|
||||
|
||||
_SecondPage(this.imageAssetName);
|
||||
const _SecondPage(this.imageAssetName);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -11,7 +11,7 @@ class HeroAnimationDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Hero Animation'),
|
||||
title: const Text('Hero Animation'),
|
||||
),
|
||||
body: GestureDetector(
|
||||
child: Hero(
|
||||
@@ -54,12 +54,12 @@ StatelessWidget _createHeroContainer({
|
||||
return Container(
|
||||
height: size,
|
||||
width: size,
|
||||
padding: EdgeInsets.all(10.0),
|
||||
margin: size < 100.0 ? EdgeInsets.all(10.0) : EdgeInsets.all(0),
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
margin: size < 100.0 ? const EdgeInsets.all(10.0) : const EdgeInsets.all(0),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: color,
|
||||
),
|
||||
child: FlutterLogo(),
|
||||
child: const FlutterLogo(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ class PhysicsCardDragDemo extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Spring Physics'),
|
||||
title: const Text('Spring Physics'),
|
||||
),
|
||||
body: DraggableCard(
|
||||
body: const DraggableCard(
|
||||
child: FlutterLogo(
|
||||
size: 128,
|
||||
),
|
||||
@@ -27,7 +27,7 @@ class PhysicsCardDragDemo extends StatelessWidget {
|
||||
/// released.
|
||||
class DraggableCard extends StatefulWidget {
|
||||
final Widget child;
|
||||
DraggableCard({required this.child});
|
||||
const DraggableCard({required this.child});
|
||||
|
||||
@override
|
||||
_DraggableCardState createState() => _DraggableCardState();
|
||||
|
||||
@@ -33,7 +33,7 @@ class RepeatingAnimationDemoState extends State<RepeatingAnimationDemo>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Repeating Animation')),
|
||||
appBar: AppBar(title: const Text('Repeating Animation')),
|
||||
body: Center(
|
||||
child: AnimatedBuilder(
|
||||
animation: _borderRadius,
|
||||
|
||||
@@ -26,10 +26,6 @@
|
||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
|
||||
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
|
||||
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -49,8 +45,6 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
|
||||
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
|
||||
);
|
||||
name = "Bundle Framework";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -69,13 +63,11 @@
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
|
||||
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
|
||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
||||
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -83,8 +75,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
|
||||
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -138,8 +128,6 @@
|
||||
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
|
||||
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
|
||||
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
|
||||
D73912EF22F37F9E000D13A0 /* App.framework */,
|
||||
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
|
||||
);
|
||||
path = Flutter;
|
||||
sourceTree = "<group>";
|
||||
@@ -260,7 +248,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n";
|
||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
|
||||
};
|
||||
33CC111E2044C6BF0003C045 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
||||
@@ -49,7 +49,7 @@ packages:
|
||||
name: cupertino_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -62,11 +62,25 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -88,13 +102,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
||||
@@ -3,7 +3,7 @@ description: A new Flutter project.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0-0 <3.0.0"
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -13,7 +13,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.9.0
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -20,7 +20,8 @@ void main() {
|
||||
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
|
||||
|
||||
// Swipe out one card.
|
||||
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0));
|
||||
await tester.drag(
|
||||
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Check if removed properly.
|
||||
@@ -37,7 +38,8 @@ void main() {
|
||||
// Swipe out all cards.
|
||||
for (var i = 0; i < totalCards; i++) {
|
||||
// Swipe out one by one.
|
||||
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0));
|
||||
await tester.drag(
|
||||
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
@@ -52,7 +54,8 @@ void main() {
|
||||
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
|
||||
|
||||
// Swipe out one card.
|
||||
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0));
|
||||
await tester.drag(
|
||||
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Tap the Refill button.
|
||||
|
||||
@@ -20,7 +20,7 @@ void main() {
|
||||
expect(imageList.length, 2);
|
||||
|
||||
// Swipe the Carousel.
|
||||
await tester.fling(find.byType(CarouselDemo), Offset(-400, 0), 800);
|
||||
await tester.fling(find.byType(CarouselDemo), const Offset(-400, 0), 800);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Get the images available on the screen after swipe.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_simple_treeview/flutter_simple_treeview.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:menubar/menubar.dart' as menubar;
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'src/model/photo_search_model.dart';
|
||||
@@ -58,7 +56,7 @@ class UnsplashSearchApp extends StatelessWidget {
|
||||
}
|
||||
|
||||
class UnsplashHomePage extends StatelessWidget {
|
||||
const UnsplashHomePage({@required this.title});
|
||||
const UnsplashHomePage({required this.title});
|
||||
final String title;
|
||||
|
||||
@override
|
||||
@@ -83,7 +81,7 @@ class UnsplashHomePage extends StatelessWidget {
|
||||
onClicked: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => PolicyDialog(),
|
||||
builder: (context) => const PolicyDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -111,7 +109,7 @@ class UnsplashHomePage extends StatelessWidget {
|
||||
secondChild: Center(
|
||||
child: photoSearchModel.selectedPhoto != null
|
||||
? PhotoDetails(
|
||||
photo: photoSearchModel.selectedPhoto,
|
||||
photo: photoSearchModel.selectedPhoto!,
|
||||
onPhotoSave: (photo) async {
|
||||
final path = await getSavePath(
|
||||
suggestedName: '${photo.id}.jpg',
|
||||
@@ -144,7 +142,7 @@ class UnsplashHomePage extends StatelessWidget {
|
||||
builder: (context) => PhotoSearchDialog(photoSearchModel.addSearch),
|
||||
),
|
||||
tooltip: 'Search for a photo',
|
||||
child: Icon(Icons.search),
|
||||
child: const Icon(Icons.search),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -165,7 +163,7 @@ class UnsplashHomePage extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Text(
|
||||
'Photo by ${photo.user.name}',
|
||||
'Photo by ${photo.user!.name}',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
import '../unsplash/photo.dart';
|
||||
import '../unsplash/unsplash.dart';
|
||||
@@ -25,13 +24,13 @@ class PhotoSearchModel extends ChangeNotifier {
|
||||
List<SearchEntry> get entries => List.unmodifiable(_entries);
|
||||
final List<SearchEntry> _entries = [];
|
||||
|
||||
Photo get selectedPhoto => _selectedPhoto;
|
||||
set selectedPhoto(Photo photo) {
|
||||
Photo? get selectedPhoto => _selectedPhoto;
|
||||
set selectedPhoto(Photo? photo) {
|
||||
_selectedPhoto = photo;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Photo _selectedPhoto;
|
||||
Photo? _selectedPhoto;
|
||||
|
||||
Future<void> addSearch(String query) async {
|
||||
final result = await _client.searchPhotos(
|
||||
@@ -41,13 +40,12 @@ class PhotoSearchModel extends ChangeNotifier {
|
||||
final search = Search((s) {
|
||||
s
|
||||
..query = query
|
||||
..results.addAll(result.results);
|
||||
..results.addAll(result!.results);
|
||||
});
|
||||
|
||||
_entries.add(SearchEntry(query, search.results.toList(), this));
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<Uint8List> download({@required Photo photo}) =>
|
||||
_client.download(photo);
|
||||
Future<Uint8List> download({required Photo photo}) => _client.download(photo);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import '../unsplash/photo.dart';
|
||||
part 'search.g.dart';
|
||||
|
||||
abstract class Search implements Built<Search, SearchBuilder> {
|
||||
factory Search([void Function(SearchBuilder) updates]) = _$Search;
|
||||
factory Search([void Function(SearchBuilder)? updates]) = _$Search;
|
||||
Search._();
|
||||
|
||||
@BuiltValueField(wireName: 'query')
|
||||
@@ -27,7 +27,7 @@ abstract class Search implements Built<Search, SearchBuilder> {
|
||||
return json.encode(serializers.serializeWith(Search.serializer, this));
|
||||
}
|
||||
|
||||
static Search fromJson(String jsonString) {
|
||||
static Search? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Search.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
|
||||
final String wireName = 'Search';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Search object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Search object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'query',
|
||||
serializers.serialize(object.query,
|
||||
specifiedType: const FullType(String)),
|
||||
@@ -35,7 +35,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
|
||||
}
|
||||
|
||||
@override
|
||||
Search deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Search deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new SearchBuilder();
|
||||
|
||||
@@ -43,7 +43,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'query':
|
||||
result.query = serializers.deserialize(value,
|
||||
@@ -52,7 +52,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
|
||||
case 'results':
|
||||
result.results.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(Photo)]))
|
||||
const FullType(BuiltList, const [const FullType(Photo)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
}
|
||||
@@ -68,10 +68,10 @@ class _$Search extends Search {
|
||||
@override
|
||||
final BuiltList<Photo> results;
|
||||
|
||||
factory _$Search([void Function(SearchBuilder) updates]) =>
|
||||
factory _$Search([void Function(SearchBuilder)? updates]) =>
|
||||
(new SearchBuilder()..update(updates)).build();
|
||||
|
||||
_$Search._({this.query, this.results}) : super._() {
|
||||
_$Search._({required this.query, required this.results}) : super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(query, 'Search', 'query');
|
||||
BuiltValueNullFieldError.checkNotNull(results, 'Search', 'results');
|
||||
}
|
||||
@@ -104,16 +104,16 @@ class _$Search extends Search {
|
||||
}
|
||||
|
||||
class SearchBuilder implements Builder<Search, SearchBuilder> {
|
||||
_$Search _$v;
|
||||
_$Search? _$v;
|
||||
|
||||
String _query;
|
||||
String get query => _$this._query;
|
||||
set query(String query) => _$this._query = query;
|
||||
String? _query;
|
||||
String? get query => _$this._query;
|
||||
set query(String? query) => _$this._query = query;
|
||||
|
||||
ListBuilder<Photo> _results;
|
||||
ListBuilder<Photo>? _results;
|
||||
ListBuilder<Photo> get results =>
|
||||
_$this._results ??= new ListBuilder<Photo>();
|
||||
set results(ListBuilder<Photo> results) => _$this._results = results;
|
||||
set results(ListBuilder<Photo>? results) => _$this._results = results;
|
||||
|
||||
SearchBuilder();
|
||||
|
||||
@@ -134,7 +134,7 @@ class SearchBuilder implements Builder<Search, SearchBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(SearchBuilder) updates) {
|
||||
void update(void Function(SearchBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class SearchBuilder implements Builder<Search, SearchBuilder> {
|
||||
query, 'Search', 'query'),
|
||||
results: results.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'results';
|
||||
results.build();
|
||||
|
||||
@@ -13,18 +13,18 @@ import '../serializers.dart';
|
||||
part 'api_error.g.dart';
|
||||
|
||||
abstract class ApiError implements Built<ApiError, ApiErrorBuilder> {
|
||||
factory ApiError([void Function(ApiErrorBuilder) updates]) = _$ApiError;
|
||||
factory ApiError([void Function(ApiErrorBuilder)? updates]) = _$ApiError;
|
||||
|
||||
ApiError._();
|
||||
|
||||
@BuiltValueField(wireName: 'errors')
|
||||
BuiltList<String> get errors;
|
||||
BuiltList<String>? get errors;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(ApiError.serializer, this));
|
||||
}
|
||||
|
||||
static ApiError fromJson(String jsonString) {
|
||||
static ApiError? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
ApiError.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,20 +19,23 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
|
||||
final String wireName = 'ApiError';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, ApiError object,
|
||||
Iterable<Object?> serialize(Serializers serializers, ApiError object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
'errors',
|
||||
serializers.serialize(object.errors,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)])),
|
||||
];
|
||||
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.errors;
|
||||
if (value != null) {
|
||||
result
|
||||
..add('errors')
|
||||
..add(serializers.serialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)])));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
ApiError deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
ApiError deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new ApiErrorBuilder();
|
||||
|
||||
@@ -40,12 +43,12 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'errors':
|
||||
result.errors.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)]))
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(String)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
}
|
||||
@@ -57,14 +60,12 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
|
||||
|
||||
class _$ApiError extends ApiError {
|
||||
@override
|
||||
final BuiltList<String> errors;
|
||||
final BuiltList<String>? errors;
|
||||
|
||||
factory _$ApiError([void Function(ApiErrorBuilder) updates]) =>
|
||||
factory _$ApiError([void Function(ApiErrorBuilder)? updates]) =>
|
||||
(new ApiErrorBuilder()..update(updates)).build();
|
||||
|
||||
_$ApiError._({this.errors}) : super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(errors, 'ApiError', 'errors');
|
||||
}
|
||||
_$ApiError._({this.errors}) : super._();
|
||||
|
||||
@override
|
||||
ApiError rebuild(void Function(ApiErrorBuilder) updates) =>
|
||||
@@ -92,19 +93,19 @@ class _$ApiError extends ApiError {
|
||||
}
|
||||
|
||||
class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
|
||||
_$ApiError _$v;
|
||||
_$ApiError? _$v;
|
||||
|
||||
ListBuilder<String> _errors;
|
||||
ListBuilder<String>? _errors;
|
||||
ListBuilder<String> get errors =>
|
||||
_$this._errors ??= new ListBuilder<String>();
|
||||
set errors(ListBuilder<String> errors) => _$this._errors = errors;
|
||||
set errors(ListBuilder<String>? errors) => _$this._errors = errors;
|
||||
|
||||
ApiErrorBuilder();
|
||||
|
||||
ApiErrorBuilder get _$this {
|
||||
final $v = _$v;
|
||||
if ($v != null) {
|
||||
_errors = $v.errors.toBuilder();
|
||||
_errors = $v.errors?.toBuilder();
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
@@ -117,7 +118,7 @@ class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(ApiErrorBuilder) updates) {
|
||||
void update(void Function(ApiErrorBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -125,12 +126,12 @@ class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
|
||||
_$ApiError build() {
|
||||
_$ApiError _$result;
|
||||
try {
|
||||
_$result = _$v ?? new _$ApiError._(errors: errors.build());
|
||||
_$result = _$v ?? new _$ApiError._(errors: _errors?.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'errors';
|
||||
errors.build();
|
||||
_errors?.build();
|
||||
} catch (e) {
|
||||
throw new BuiltValueNestedFieldError(
|
||||
'ApiError', _$failedField, e.toString());
|
||||
|
||||
@@ -14,7 +14,7 @@ part 'current_user_collections.g.dart';
|
||||
abstract class CurrentUserCollections
|
||||
implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
|
||||
factory CurrentUserCollections(
|
||||
[void Function(CurrentUserCollectionsBuilder) updates]) =
|
||||
[void Function(CurrentUserCollectionsBuilder)? updates]) =
|
||||
_$CurrentUserCollections;
|
||||
|
||||
CurrentUserCollections._();
|
||||
@@ -22,24 +22,21 @@ abstract class CurrentUserCollections
|
||||
@BuiltValueField(wireName: 'id')
|
||||
int get id;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'title')
|
||||
String get title;
|
||||
String? get title;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'published_at')
|
||||
String get publishedAt;
|
||||
String? get publishedAt;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'updated_at')
|
||||
String get updatedAt;
|
||||
String? get updatedAt;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(
|
||||
serializers.serializeWith(CurrentUserCollections.serializer, this));
|
||||
}
|
||||
|
||||
static CurrentUserCollections fromJson(String jsonString) {
|
||||
static CurrentUserCollections? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
CurrentUserCollections.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ class _$CurrentUserCollectionsSerializer
|
||||
final String wireName = 'CurrentUserCollections';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(
|
||||
Iterable<Object?> serialize(
|
||||
Serializers serializers, CurrentUserCollections object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'id',
|
||||
serializers.serialize(object.id, specifiedType: const FullType(int)),
|
||||
];
|
||||
Object value;
|
||||
Object? value;
|
||||
value = object.title;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -58,7 +58,7 @@ class _$CurrentUserCollectionsSerializer
|
||||
|
||||
@override
|
||||
CurrentUserCollections deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new CurrentUserCollectionsBuilder();
|
||||
|
||||
@@ -66,7 +66,7 @@ class _$CurrentUserCollectionsSerializer
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'id':
|
||||
result.id = serializers.deserialize(value,
|
||||
@@ -95,18 +95,18 @@ class _$CurrentUserCollections extends CurrentUserCollections {
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String title;
|
||||
final String? title;
|
||||
@override
|
||||
final String publishedAt;
|
||||
final String? publishedAt;
|
||||
@override
|
||||
final String updatedAt;
|
||||
final String? updatedAt;
|
||||
|
||||
factory _$CurrentUserCollections(
|
||||
[void Function(CurrentUserCollectionsBuilder) updates]) =>
|
||||
[void Function(CurrentUserCollectionsBuilder)? updates]) =>
|
||||
(new CurrentUserCollectionsBuilder()..update(updates)).build();
|
||||
|
||||
_$CurrentUserCollections._(
|
||||
{this.id, this.title, this.publishedAt, this.updatedAt})
|
||||
{required this.id, this.title, this.publishedAt, this.updatedAt})
|
||||
: super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(id, 'CurrentUserCollections', 'id');
|
||||
}
|
||||
@@ -150,23 +150,23 @@ class _$CurrentUserCollections extends CurrentUserCollections {
|
||||
|
||||
class CurrentUserCollectionsBuilder
|
||||
implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
|
||||
_$CurrentUserCollections _$v;
|
||||
_$CurrentUserCollections? _$v;
|
||||
|
||||
int _id;
|
||||
int get id => _$this._id;
|
||||
set id(int id) => _$this._id = id;
|
||||
int? _id;
|
||||
int? get id => _$this._id;
|
||||
set id(int? id) => _$this._id = id;
|
||||
|
||||
String _title;
|
||||
String get title => _$this._title;
|
||||
set title(String title) => _$this._title = title;
|
||||
String? _title;
|
||||
String? get title => _$this._title;
|
||||
set title(String? title) => _$this._title = title;
|
||||
|
||||
String _publishedAt;
|
||||
String get publishedAt => _$this._publishedAt;
|
||||
set publishedAt(String publishedAt) => _$this._publishedAt = publishedAt;
|
||||
String? _publishedAt;
|
||||
String? get publishedAt => _$this._publishedAt;
|
||||
set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt;
|
||||
|
||||
String _updatedAt;
|
||||
String get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt;
|
||||
String? _updatedAt;
|
||||
String? get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
|
||||
|
||||
CurrentUserCollectionsBuilder();
|
||||
|
||||
@@ -189,7 +189,7 @@ class CurrentUserCollectionsBuilder
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(CurrentUserCollectionsBuilder) updates) {
|
||||
void update(void Function(CurrentUserCollectionsBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,39 +12,33 @@ import '../serializers.dart';
|
||||
part 'exif.g.dart';
|
||||
|
||||
abstract class Exif implements Built<Exif, ExifBuilder> {
|
||||
factory Exif([void Function(ExifBuilder) updates]) = _$Exif;
|
||||
factory Exif([void Function(ExifBuilder)? updates]) = _$Exif;
|
||||
|
||||
Exif._();
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'make')
|
||||
String get make;
|
||||
String? get make;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'model')
|
||||
String get model;
|
||||
String? get model;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'exposure_time')
|
||||
String get exposureTime;
|
||||
String? get exposureTime;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'aperture')
|
||||
String get aperture;
|
||||
String? get aperture;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'focal_length')
|
||||
String get focalLength;
|
||||
String? get focalLength;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'iso')
|
||||
int get iso;
|
||||
int? get iso;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(Exif.serializer, this));
|
||||
}
|
||||
|
||||
static Exif fromJson(String jsonString) {
|
||||
static Exif? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Exif.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
|
||||
final String wireName = 'Exif';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Exif object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Exif object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
Object value;
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.make;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -68,7 +68,7 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
|
||||
}
|
||||
|
||||
@override
|
||||
Exif deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Exif deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new ExifBuilder();
|
||||
|
||||
@@ -76,7 +76,7 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'make':
|
||||
result.make = serializers.deserialize(value,
|
||||
@@ -111,19 +111,19 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
|
||||
|
||||
class _$Exif extends Exif {
|
||||
@override
|
||||
final String make;
|
||||
final String? make;
|
||||
@override
|
||||
final String model;
|
||||
final String? model;
|
||||
@override
|
||||
final String exposureTime;
|
||||
final String? exposureTime;
|
||||
@override
|
||||
final String aperture;
|
||||
final String? aperture;
|
||||
@override
|
||||
final String focalLength;
|
||||
final String? focalLength;
|
||||
@override
|
||||
final int iso;
|
||||
final int? iso;
|
||||
|
||||
factory _$Exif([void Function(ExifBuilder) updates]) =>
|
||||
factory _$Exif([void Function(ExifBuilder)? updates]) =>
|
||||
(new ExifBuilder()..update(updates)).build();
|
||||
|
||||
_$Exif._(
|
||||
@@ -180,31 +180,31 @@ class _$Exif extends Exif {
|
||||
}
|
||||
|
||||
class ExifBuilder implements Builder<Exif, ExifBuilder> {
|
||||
_$Exif _$v;
|
||||
_$Exif? _$v;
|
||||
|
||||
String _make;
|
||||
String get make => _$this._make;
|
||||
set make(String make) => _$this._make = make;
|
||||
String? _make;
|
||||
String? get make => _$this._make;
|
||||
set make(String? make) => _$this._make = make;
|
||||
|
||||
String _model;
|
||||
String get model => _$this._model;
|
||||
set model(String model) => _$this._model = model;
|
||||
String? _model;
|
||||
String? get model => _$this._model;
|
||||
set model(String? model) => _$this._model = model;
|
||||
|
||||
String _exposureTime;
|
||||
String get exposureTime => _$this._exposureTime;
|
||||
set exposureTime(String exposureTime) => _$this._exposureTime = exposureTime;
|
||||
String? _exposureTime;
|
||||
String? get exposureTime => _$this._exposureTime;
|
||||
set exposureTime(String? exposureTime) => _$this._exposureTime = exposureTime;
|
||||
|
||||
String _aperture;
|
||||
String get aperture => _$this._aperture;
|
||||
set aperture(String aperture) => _$this._aperture = aperture;
|
||||
String? _aperture;
|
||||
String? get aperture => _$this._aperture;
|
||||
set aperture(String? aperture) => _$this._aperture = aperture;
|
||||
|
||||
String _focalLength;
|
||||
String get focalLength => _$this._focalLength;
|
||||
set focalLength(String focalLength) => _$this._focalLength = focalLength;
|
||||
String? _focalLength;
|
||||
String? get focalLength => _$this._focalLength;
|
||||
set focalLength(String? focalLength) => _$this._focalLength = focalLength;
|
||||
|
||||
int _iso;
|
||||
int get iso => _$this._iso;
|
||||
set iso(int iso) => _$this._iso = iso;
|
||||
int? _iso;
|
||||
int? get iso => _$this._iso;
|
||||
set iso(int? iso) => _$this._iso = iso;
|
||||
|
||||
ExifBuilder();
|
||||
|
||||
@@ -229,7 +229,7 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(ExifBuilder) updates) {
|
||||
void update(void Function(ExifBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,31 +12,27 @@ import '../serializers.dart';
|
||||
part 'links.g.dart';
|
||||
|
||||
abstract class Links implements Built<Links, LinksBuilder> {
|
||||
factory Links([void Function(LinksBuilder) updates]) = _$Links;
|
||||
factory Links([void Function(LinksBuilder)? updates]) = _$Links;
|
||||
|
||||
Links._();
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'self')
|
||||
String get self;
|
||||
String? get self;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'html')
|
||||
String get html;
|
||||
String? get html;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'download')
|
||||
String get download;
|
||||
String? get download;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'download_location')
|
||||
String get downloadLocation;
|
||||
String? get downloadLocation;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(Links.serializer, this));
|
||||
}
|
||||
|
||||
static Links fromJson(String jsonString) {
|
||||
static Links? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Links.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
|
||||
final String wireName = 'Links';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Links object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Links object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
Object value;
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.self;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -55,7 +55,7 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
|
||||
}
|
||||
|
||||
@override
|
||||
Links deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Links deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new LinksBuilder();
|
||||
|
||||
@@ -63,7 +63,7 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'self':
|
||||
result.self = serializers.deserialize(value,
|
||||
@@ -90,15 +90,15 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
|
||||
|
||||
class _$Links extends Links {
|
||||
@override
|
||||
final String self;
|
||||
final String? self;
|
||||
@override
|
||||
final String html;
|
||||
final String? html;
|
||||
@override
|
||||
final String download;
|
||||
final String? download;
|
||||
@override
|
||||
final String downloadLocation;
|
||||
final String? downloadLocation;
|
||||
|
||||
factory _$Links([void Function(LinksBuilder) updates]) =>
|
||||
factory _$Links([void Function(LinksBuilder)? updates]) =>
|
||||
(new LinksBuilder()..update(updates)).build();
|
||||
|
||||
_$Links._({this.self, this.html, this.download, this.downloadLocation})
|
||||
@@ -140,23 +140,23 @@ class _$Links extends Links {
|
||||
}
|
||||
|
||||
class LinksBuilder implements Builder<Links, LinksBuilder> {
|
||||
_$Links _$v;
|
||||
_$Links? _$v;
|
||||
|
||||
String _self;
|
||||
String get self => _$this._self;
|
||||
set self(String self) => _$this._self = self;
|
||||
String? _self;
|
||||
String? get self => _$this._self;
|
||||
set self(String? self) => _$this._self = self;
|
||||
|
||||
String _html;
|
||||
String get html => _$this._html;
|
||||
set html(String html) => _$this._html = html;
|
||||
String? _html;
|
||||
String? get html => _$this._html;
|
||||
set html(String? html) => _$this._html = html;
|
||||
|
||||
String _download;
|
||||
String get download => _$this._download;
|
||||
set download(String download) => _$this._download = download;
|
||||
String? _download;
|
||||
String? get download => _$this._download;
|
||||
set download(String? download) => _$this._download = download;
|
||||
|
||||
String _downloadLocation;
|
||||
String get downloadLocation => _$this._downloadLocation;
|
||||
set downloadLocation(String downloadLocation) =>
|
||||
String? _downloadLocation;
|
||||
String? get downloadLocation => _$this._downloadLocation;
|
||||
set downloadLocation(String? downloadLocation) =>
|
||||
_$this._downloadLocation = downloadLocation;
|
||||
|
||||
LinksBuilder();
|
||||
@@ -180,7 +180,7 @@ class LinksBuilder implements Builder<Links, LinksBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(LinksBuilder) updates) {
|
||||
void update(void Function(LinksBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,27 +13,24 @@ import 'position.dart';
|
||||
part 'location.g.dart';
|
||||
|
||||
abstract class Location implements Built<Location, LocationBuilder> {
|
||||
factory Location([void Function(LocationBuilder) updates]) = _$Location;
|
||||
factory Location([void Function(LocationBuilder)? updates]) = _$Location;
|
||||
|
||||
Location._();
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'city')
|
||||
String get city;
|
||||
String? get city;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'country')
|
||||
String get country;
|
||||
String? get country;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'position')
|
||||
Position get position;
|
||||
Position? get position;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(Location.serializer, this));
|
||||
}
|
||||
|
||||
static Location fromJson(String jsonString) {
|
||||
static Location? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Location.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
|
||||
final String wireName = 'Location';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Location object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Location object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
Object value;
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.city;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -48,7 +48,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
|
||||
}
|
||||
|
||||
@override
|
||||
Location deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Location deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new LocationBuilder();
|
||||
|
||||
@@ -56,7 +56,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'city':
|
||||
result.city = serializers.deserialize(value,
|
||||
@@ -68,7 +68,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
|
||||
break;
|
||||
case 'position':
|
||||
result.position.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Position)) as Position);
|
||||
specifiedType: const FullType(Position))! as Position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -79,13 +79,13 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
|
||||
|
||||
class _$Location extends Location {
|
||||
@override
|
||||
final String city;
|
||||
final String? city;
|
||||
@override
|
||||
final String country;
|
||||
final String? country;
|
||||
@override
|
||||
final Position position;
|
||||
final Position? position;
|
||||
|
||||
factory _$Location([void Function(LocationBuilder) updates]) =>
|
||||
factory _$Location([void Function(LocationBuilder)? updates]) =>
|
||||
(new LocationBuilder()..update(updates)).build();
|
||||
|
||||
_$Location._({this.city, this.country, this.position}) : super._();
|
||||
@@ -123,19 +123,19 @@ class _$Location extends Location {
|
||||
}
|
||||
|
||||
class LocationBuilder implements Builder<Location, LocationBuilder> {
|
||||
_$Location _$v;
|
||||
_$Location? _$v;
|
||||
|
||||
String _city;
|
||||
String get city => _$this._city;
|
||||
set city(String city) => _$this._city = city;
|
||||
String? _city;
|
||||
String? get city => _$this._city;
|
||||
set city(String? city) => _$this._city = city;
|
||||
|
||||
String _country;
|
||||
String get country => _$this._country;
|
||||
set country(String country) => _$this._country = country;
|
||||
String? _country;
|
||||
String? get country => _$this._country;
|
||||
set country(String? country) => _$this._country = country;
|
||||
|
||||
PositionBuilder _position;
|
||||
PositionBuilder? _position;
|
||||
PositionBuilder get position => _$this._position ??= new PositionBuilder();
|
||||
set position(PositionBuilder position) => _$this._position = position;
|
||||
set position(PositionBuilder? position) => _$this._position = position;
|
||||
|
||||
LocationBuilder();
|
||||
|
||||
@@ -157,7 +157,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(LocationBuilder) updates) {
|
||||
void update(void Function(LocationBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
|
||||
new _$Location._(
|
||||
city: city, country: country, position: _position?.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'position';
|
||||
_position?.build();
|
||||
|
||||
@@ -20,82 +20,66 @@ import 'user.dart';
|
||||
part 'photo.g.dart';
|
||||
|
||||
abstract class Photo implements Built<Photo, PhotoBuilder> {
|
||||
factory Photo([void Function(PhotoBuilder) updates]) = _$Photo;
|
||||
factory Photo([void Function(PhotoBuilder)? updates]) = _$Photo;
|
||||
|
||||
Photo._();
|
||||
|
||||
@BuiltValueField(wireName: 'id')
|
||||
String get id;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'created_at')
|
||||
String get createdAt;
|
||||
String? get createdAt;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'updated_at')
|
||||
String get updatedAt;
|
||||
String? get updatedAt;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'width')
|
||||
int get width;
|
||||
int? get width;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'height')
|
||||
int get height;
|
||||
int? get height;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'color')
|
||||
String get color;
|
||||
String? get color;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'downloads')
|
||||
int get downloads;
|
||||
int? get downloads;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'likes')
|
||||
int get likes;
|
||||
int? get likes;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'liked_by_user')
|
||||
bool get likedByUser;
|
||||
bool? get likedByUser;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'description')
|
||||
String get description;
|
||||
String? get description;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'exif')
|
||||
Exif get exif;
|
||||
Exif? get exif;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'location')
|
||||
Location get location;
|
||||
Location? get location;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'tags')
|
||||
BuiltList<Tags> get tags;
|
||||
BuiltList<Tags>? get tags;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'current_user_collections')
|
||||
BuiltList<CurrentUserCollections> get currentUserCollections;
|
||||
BuiltList<CurrentUserCollections>? get currentUserCollections;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'urls')
|
||||
Urls get urls;
|
||||
Urls? get urls;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'links')
|
||||
Links get links;
|
||||
Links? get links;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'user')
|
||||
User get user;
|
||||
User? get user;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(Photo.serializer, this));
|
||||
}
|
||||
|
||||
static Photo fromJson(String jsonString) {
|
||||
static Photo? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Photo.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
|
||||
final String wireName = 'Photo';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Photo object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Photo object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'id',
|
||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||
];
|
||||
Object value;
|
||||
Object? value;
|
||||
value = object.createdAt;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -140,7 +140,7 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
|
||||
}
|
||||
|
||||
@override
|
||||
Photo deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Photo deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new PhotoBuilder();
|
||||
|
||||
@@ -148,7 +148,7 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'id':
|
||||
result.id = serializers.deserialize(value,
|
||||
@@ -192,35 +192,35 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
|
||||
break;
|
||||
case 'exif':
|
||||
result.exif.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Exif)) as Exif);
|
||||
specifiedType: const FullType(Exif))! as Exif);
|
||||
break;
|
||||
case 'location':
|
||||
result.location.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Location)) as Location);
|
||||
specifiedType: const FullType(Location))! as Location);
|
||||
break;
|
||||
case 'tags':
|
||||
result.tags.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(Tags)]))
|
||||
const FullType(BuiltList, const [const FullType(Tags)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'current_user_collections':
|
||||
result.currentUserCollections.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(BuiltList, const [
|
||||
const FullType(CurrentUserCollections)
|
||||
])) as BuiltList<Object>);
|
||||
]))! as BuiltList<Object>);
|
||||
break;
|
||||
case 'urls':
|
||||
result.urls.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Urls)) as Urls);
|
||||
specifiedType: const FullType(Urls))! as Urls);
|
||||
break;
|
||||
case 'links':
|
||||
result.links.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Links)) as Links);
|
||||
specifiedType: const FullType(Links))! as Links);
|
||||
break;
|
||||
case 'user':
|
||||
result.user.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(User)) as User);
|
||||
specifiedType: const FullType(User))! as User);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -233,43 +233,43 @@ class _$Photo extends Photo {
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String createdAt;
|
||||
final String? createdAt;
|
||||
@override
|
||||
final String updatedAt;
|
||||
final String? updatedAt;
|
||||
@override
|
||||
final int width;
|
||||
final int? width;
|
||||
@override
|
||||
final int height;
|
||||
final int? height;
|
||||
@override
|
||||
final String color;
|
||||
final String? color;
|
||||
@override
|
||||
final int downloads;
|
||||
final int? downloads;
|
||||
@override
|
||||
final int likes;
|
||||
final int? likes;
|
||||
@override
|
||||
final bool likedByUser;
|
||||
final bool? likedByUser;
|
||||
@override
|
||||
final String description;
|
||||
final String? description;
|
||||
@override
|
||||
final Exif exif;
|
||||
final Exif? exif;
|
||||
@override
|
||||
final Location location;
|
||||
final Location? location;
|
||||
@override
|
||||
final BuiltList<Tags> tags;
|
||||
final BuiltList<Tags>? tags;
|
||||
@override
|
||||
final BuiltList<CurrentUserCollections> currentUserCollections;
|
||||
final BuiltList<CurrentUserCollections>? currentUserCollections;
|
||||
@override
|
||||
final Urls urls;
|
||||
final Urls? urls;
|
||||
@override
|
||||
final Links links;
|
||||
final Links? links;
|
||||
@override
|
||||
final User user;
|
||||
final User? user;
|
||||
|
||||
factory _$Photo([void Function(PhotoBuilder) updates]) =>
|
||||
factory _$Photo([void Function(PhotoBuilder)? updates]) =>
|
||||
(new PhotoBuilder()..update(updates)).build();
|
||||
|
||||
_$Photo._(
|
||||
{this.id,
|
||||
{required this.id,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.width,
|
||||
@@ -387,79 +387,79 @@ class _$Photo extends Photo {
|
||||
}
|
||||
|
||||
class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
|
||||
_$Photo _$v;
|
||||
_$Photo? _$v;
|
||||
|
||||
String _id;
|
||||
String get id => _$this._id;
|
||||
set id(String id) => _$this._id = id;
|
||||
String? _id;
|
||||
String? get id => _$this._id;
|
||||
set id(String? id) => _$this._id = id;
|
||||
|
||||
String _createdAt;
|
||||
String get createdAt => _$this._createdAt;
|
||||
set createdAt(String createdAt) => _$this._createdAt = createdAt;
|
||||
String? _createdAt;
|
||||
String? get createdAt => _$this._createdAt;
|
||||
set createdAt(String? createdAt) => _$this._createdAt = createdAt;
|
||||
|
||||
String _updatedAt;
|
||||
String get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt;
|
||||
String? _updatedAt;
|
||||
String? get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
|
||||
|
||||
int _width;
|
||||
int get width => _$this._width;
|
||||
set width(int width) => _$this._width = width;
|
||||
int? _width;
|
||||
int? get width => _$this._width;
|
||||
set width(int? width) => _$this._width = width;
|
||||
|
||||
int _height;
|
||||
int get height => _$this._height;
|
||||
set height(int height) => _$this._height = height;
|
||||
int? _height;
|
||||
int? get height => _$this._height;
|
||||
set height(int? height) => _$this._height = height;
|
||||
|
||||
String _color;
|
||||
String get color => _$this._color;
|
||||
set color(String color) => _$this._color = color;
|
||||
String? _color;
|
||||
String? get color => _$this._color;
|
||||
set color(String? color) => _$this._color = color;
|
||||
|
||||
int _downloads;
|
||||
int get downloads => _$this._downloads;
|
||||
set downloads(int downloads) => _$this._downloads = downloads;
|
||||
int? _downloads;
|
||||
int? get downloads => _$this._downloads;
|
||||
set downloads(int? downloads) => _$this._downloads = downloads;
|
||||
|
||||
int _likes;
|
||||
int get likes => _$this._likes;
|
||||
set likes(int likes) => _$this._likes = likes;
|
||||
int? _likes;
|
||||
int? get likes => _$this._likes;
|
||||
set likes(int? likes) => _$this._likes = likes;
|
||||
|
||||
bool _likedByUser;
|
||||
bool get likedByUser => _$this._likedByUser;
|
||||
set likedByUser(bool likedByUser) => _$this._likedByUser = likedByUser;
|
||||
bool? _likedByUser;
|
||||
bool? get likedByUser => _$this._likedByUser;
|
||||
set likedByUser(bool? likedByUser) => _$this._likedByUser = likedByUser;
|
||||
|
||||
String _description;
|
||||
String get description => _$this._description;
|
||||
set description(String description) => _$this._description = description;
|
||||
String? _description;
|
||||
String? get description => _$this._description;
|
||||
set description(String? description) => _$this._description = description;
|
||||
|
||||
ExifBuilder _exif;
|
||||
ExifBuilder? _exif;
|
||||
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();
|
||||
set location(LocationBuilder location) => _$this._location = location;
|
||||
set location(LocationBuilder? location) => _$this._location = location;
|
||||
|
||||
ListBuilder<Tags> _tags;
|
||||
ListBuilder<Tags>? _tags;
|
||||
ListBuilder<Tags> get tags => _$this._tags ??= new ListBuilder<Tags>();
|
||||
set tags(ListBuilder<Tags> tags) => _$this._tags = tags;
|
||||
set tags(ListBuilder<Tags>? tags) => _$this._tags = tags;
|
||||
|
||||
ListBuilder<CurrentUserCollections> _currentUserCollections;
|
||||
ListBuilder<CurrentUserCollections>? _currentUserCollections;
|
||||
ListBuilder<CurrentUserCollections> get currentUserCollections =>
|
||||
_$this._currentUserCollections ??=
|
||||
new ListBuilder<CurrentUserCollections>();
|
||||
set currentUserCollections(
|
||||
ListBuilder<CurrentUserCollections> currentUserCollections) =>
|
||||
ListBuilder<CurrentUserCollections>? currentUserCollections) =>
|
||||
_$this._currentUserCollections = currentUserCollections;
|
||||
|
||||
UrlsBuilder _urls;
|
||||
UrlsBuilder? _urls;
|
||||
UrlsBuilder get urls => _$this._urls ??= new UrlsBuilder();
|
||||
set urls(UrlsBuilder urls) => _$this._urls = urls;
|
||||
set urls(UrlsBuilder? urls) => _$this._urls = urls;
|
||||
|
||||
LinksBuilder _links;
|
||||
LinksBuilder? _links;
|
||||
LinksBuilder get links => _$this._links ??= new LinksBuilder();
|
||||
set links(LinksBuilder links) => _$this._links = links;
|
||||
set links(LinksBuilder? links) => _$this._links = links;
|
||||
|
||||
UserBuilder _user;
|
||||
UserBuilder? _user;
|
||||
UserBuilder get user => _$this._user ??= new UserBuilder();
|
||||
set user(UserBuilder user) => _$this._user = user;
|
||||
set user(UserBuilder? user) => _$this._user = user;
|
||||
|
||||
PhotoBuilder();
|
||||
|
||||
@@ -495,7 +495,7 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(PhotoBuilder) updates) {
|
||||
void update(void Function(PhotoBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
|
||||
links: _links?.build(),
|
||||
user: _user?.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'exif';
|
||||
_exif?.build();
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../serializers.dart';
|
||||
part 'position.g.dart';
|
||||
|
||||
abstract class Position implements Built<Position, PositionBuilder> {
|
||||
factory Position([void Function(PositionBuilder) updates]) = _$Position;
|
||||
factory Position([void Function(PositionBuilder)? updates]) = _$Position;
|
||||
|
||||
Position._();
|
||||
|
||||
@@ -26,7 +26,7 @@ abstract class Position implements Built<Position, PositionBuilder> {
|
||||
return json.encode(serializers.serializeWith(Position.serializer, this));
|
||||
}
|
||||
|
||||
static Position fromJson(String jsonString) {
|
||||
static Position? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Position.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
|
||||
final String wireName = 'Position';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Position object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Position object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'latitude',
|
||||
serializers.serialize(object.latitude,
|
||||
specifiedType: const FullType(double)),
|
||||
@@ -34,7 +34,7 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
|
||||
}
|
||||
|
||||
@override
|
||||
Position deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Position deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new PositionBuilder();
|
||||
|
||||
@@ -42,7 +42,7 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'latitude':
|
||||
result.latitude = serializers.deserialize(value,
|
||||
@@ -65,10 +65,10 @@ class _$Position extends Position {
|
||||
@override
|
||||
final double longitude;
|
||||
|
||||
factory _$Position([void Function(PositionBuilder) updates]) =>
|
||||
factory _$Position([void Function(PositionBuilder)? updates]) =>
|
||||
(new PositionBuilder()..update(updates)).build();
|
||||
|
||||
_$Position._({this.latitude, this.longitude}) : super._() {
|
||||
_$Position._({required this.latitude, required this.longitude}) : super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(latitude, 'Position', 'latitude');
|
||||
BuiltValueNullFieldError.checkNotNull(longitude, 'Position', 'longitude');
|
||||
}
|
||||
@@ -103,15 +103,15 @@ class _$Position extends Position {
|
||||
}
|
||||
|
||||
class PositionBuilder implements Builder<Position, PositionBuilder> {
|
||||
_$Position _$v;
|
||||
_$Position? _$v;
|
||||
|
||||
double _latitude;
|
||||
double get latitude => _$this._latitude;
|
||||
set latitude(double latitude) => _$this._latitude = latitude;
|
||||
double? _latitude;
|
||||
double? get latitude => _$this._latitude;
|
||||
set latitude(double? latitude) => _$this._latitude = latitude;
|
||||
|
||||
double _longitude;
|
||||
double get longitude => _$this._longitude;
|
||||
set longitude(double longitude) => _$this._longitude = longitude;
|
||||
double? _longitude;
|
||||
double? get longitude => _$this._longitude;
|
||||
set longitude(double? longitude) => _$this._longitude = longitude;
|
||||
|
||||
PositionBuilder();
|
||||
|
||||
@@ -132,7 +132,7 @@ class PositionBuilder implements Builder<Position, PositionBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(PositionBuilder) updates) {
|
||||
void update(void Function(PositionBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,18 +16,16 @@ part 'search_photos_response.g.dart';
|
||||
abstract class SearchPhotosResponse
|
||||
implements Built<SearchPhotosResponse, SearchPhotosResponseBuilder> {
|
||||
factory SearchPhotosResponse(
|
||||
[void Function(SearchPhotosResponseBuilder) updates]) =
|
||||
[void Function(SearchPhotosResponseBuilder)? updates]) =
|
||||
_$SearchPhotosResponse;
|
||||
|
||||
SearchPhotosResponse._();
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'total')
|
||||
int get total;
|
||||
int? get total;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'total_pages')
|
||||
int get totalPages;
|
||||
int? get totalPages;
|
||||
|
||||
@BuiltValueField(wireName: 'results')
|
||||
BuiltList<Photo> get results;
|
||||
@@ -37,7 +35,7 @@ abstract class SearchPhotosResponse
|
||||
serializers.serializeWith(SearchPhotosResponse.serializer, this));
|
||||
}
|
||||
|
||||
static SearchPhotosResponse fromJson(String jsonString) {
|
||||
static SearchPhotosResponse? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
SearchPhotosResponse.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -24,16 +24,16 @@ class _$SearchPhotosResponseSerializer
|
||||
final String wireName = 'SearchPhotosResponse';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(
|
||||
Iterable<Object?> serialize(
|
||||
Serializers serializers, SearchPhotosResponse object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'results',
|
||||
serializers.serialize(object.results,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(Photo)])),
|
||||
];
|
||||
Object value;
|
||||
Object? value;
|
||||
value = object.total;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -51,7 +51,7 @@ class _$SearchPhotosResponseSerializer
|
||||
|
||||
@override
|
||||
SearchPhotosResponse deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new SearchPhotosResponseBuilder();
|
||||
|
||||
@@ -59,7 +59,7 @@ class _$SearchPhotosResponseSerializer
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'total':
|
||||
result.total = serializers.deserialize(value,
|
||||
@@ -72,7 +72,7 @@ class _$SearchPhotosResponseSerializer
|
||||
case 'results':
|
||||
result.results.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(Photo)]))
|
||||
const FullType(BuiltList, const [const FullType(Photo)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
}
|
||||
@@ -84,17 +84,17 @@ class _$SearchPhotosResponseSerializer
|
||||
|
||||
class _$SearchPhotosResponse extends SearchPhotosResponse {
|
||||
@override
|
||||
final int total;
|
||||
final int? total;
|
||||
@override
|
||||
final int totalPages;
|
||||
final int? totalPages;
|
||||
@override
|
||||
final BuiltList<Photo> results;
|
||||
|
||||
factory _$SearchPhotosResponse(
|
||||
[void Function(SearchPhotosResponseBuilder) updates]) =>
|
||||
[void Function(SearchPhotosResponseBuilder)? updates]) =>
|
||||
(new SearchPhotosResponseBuilder()..update(updates)).build();
|
||||
|
||||
_$SearchPhotosResponse._({this.total, this.totalPages, this.results})
|
||||
_$SearchPhotosResponse._({this.total, this.totalPages, required this.results})
|
||||
: super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
results, 'SearchPhotosResponse', 'results');
|
||||
@@ -136,20 +136,20 @@ class _$SearchPhotosResponse extends SearchPhotosResponse {
|
||||
|
||||
class SearchPhotosResponseBuilder
|
||||
implements Builder<SearchPhotosResponse, SearchPhotosResponseBuilder> {
|
||||
_$SearchPhotosResponse _$v;
|
||||
_$SearchPhotosResponse? _$v;
|
||||
|
||||
int _total;
|
||||
int get total => _$this._total;
|
||||
set total(int total) => _$this._total = total;
|
||||
int? _total;
|
||||
int? get total => _$this._total;
|
||||
set total(int? total) => _$this._total = total;
|
||||
|
||||
int _totalPages;
|
||||
int get totalPages => _$this._totalPages;
|
||||
set totalPages(int totalPages) => _$this._totalPages = totalPages;
|
||||
int? _totalPages;
|
||||
int? get totalPages => _$this._totalPages;
|
||||
set totalPages(int? totalPages) => _$this._totalPages = totalPages;
|
||||
|
||||
ListBuilder<Photo> _results;
|
||||
ListBuilder<Photo>? _results;
|
||||
ListBuilder<Photo> get results =>
|
||||
_$this._results ??= new ListBuilder<Photo>();
|
||||
set results(ListBuilder<Photo> results) => _$this._results = results;
|
||||
set results(ListBuilder<Photo>? results) => _$this._results = results;
|
||||
|
||||
SearchPhotosResponseBuilder();
|
||||
|
||||
@@ -171,7 +171,7 @@ class SearchPhotosResponseBuilder
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(SearchPhotosResponseBuilder) updates) {
|
||||
void update(void Function(SearchPhotosResponseBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ class SearchPhotosResponseBuilder
|
||||
new _$SearchPhotosResponse._(
|
||||
total: total, totalPages: totalPages, results: results.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'results';
|
||||
results.build();
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../serializers.dart';
|
||||
part 'tags.g.dart';
|
||||
|
||||
abstract class Tags implements Built<Tags, TagsBuilder> {
|
||||
factory Tags([void Function(TagsBuilder) updates]) = _$Tags;
|
||||
factory Tags([void Function(TagsBuilder)? updates]) = _$Tags;
|
||||
|
||||
Tags._();
|
||||
|
||||
@@ -23,7 +23,7 @@ abstract class Tags implements Built<Tags, TagsBuilder> {
|
||||
return json.encode(serializers.serializeWith(Tags.serializer, this));
|
||||
}
|
||||
|
||||
static Tags fromJson(String jsonString) {
|
||||
static Tags? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Tags.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
|
||||
final String wireName = 'Tags';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Tags object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Tags object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'title',
|
||||
serializers.serialize(object.title,
|
||||
specifiedType: const FullType(String)),
|
||||
@@ -31,7 +31,7 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
|
||||
}
|
||||
|
||||
@override
|
||||
Tags deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Tags deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new TagsBuilder();
|
||||
|
||||
@@ -39,7 +39,7 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'title':
|
||||
result.title = serializers.deserialize(value,
|
||||
@@ -56,10 +56,10 @@ class _$Tags extends Tags {
|
||||
@override
|
||||
final String title;
|
||||
|
||||
factory _$Tags([void Function(TagsBuilder) updates]) =>
|
||||
factory _$Tags([void Function(TagsBuilder)? updates]) =>
|
||||
(new TagsBuilder()..update(updates)).build();
|
||||
|
||||
_$Tags._({this.title}) : super._() {
|
||||
_$Tags._({required this.title}) : super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(title, 'Tags', 'title');
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ class _$Tags extends Tags {
|
||||
}
|
||||
|
||||
class TagsBuilder implements Builder<Tags, TagsBuilder> {
|
||||
_$Tags _$v;
|
||||
_$Tags? _$v;
|
||||
|
||||
String _title;
|
||||
String get title => _$this._title;
|
||||
set title(String title) => _$this._title = title;
|
||||
String? _title;
|
||||
String? get title => _$this._title;
|
||||
set title(String? title) => _$this._title = title;
|
||||
|
||||
TagsBuilder();
|
||||
|
||||
@@ -113,7 +113,7 @@ class TagsBuilder implements Builder<Tags, TagsBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(TagsBuilder) updates) {
|
||||
void update(void Function(TagsBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'dart:typed_data';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:pedantic/pedantic.dart';
|
||||
|
||||
import 'api_error.dart';
|
||||
@@ -21,30 +20,28 @@ final _unsplashBaseUrl = Uri.parse('https://api.unsplash.com/');
|
||||
/// requests to the Unsplash API.
|
||||
class Unsplash {
|
||||
Unsplash({
|
||||
@required String accessKey,
|
||||
http.BaseClient httpClient,
|
||||
}) : assert(accessKey != null, 'accessKey must not be null'),
|
||||
_accessKey = accessKey,
|
||||
required String accessKey,
|
||||
http.BaseClient? httpClient,
|
||||
}) : _accessKey = accessKey,
|
||||
_client = httpClient ?? http.Client();
|
||||
|
||||
final String _accessKey;
|
||||
final http.Client _client;
|
||||
final _log = Logger('Unsplash');
|
||||
|
||||
Future<SearchPhotosResponse> searchPhotos({
|
||||
@required String query,
|
||||
Future<SearchPhotosResponse?> searchPhotos({
|
||||
required String query,
|
||||
num page = 1,
|
||||
num perPage = 10,
|
||||
List<num> collections = const [],
|
||||
SearchPhotosOrientation orientation,
|
||||
SearchPhotosOrientation? orientation,
|
||||
}) async {
|
||||
final searchPhotosUrl = _unsplashBaseUrl
|
||||
.replace(path: '/search/photos', queryParameters: <String, String>{
|
||||
'query': query,
|
||||
if (page != 1) 'page': '$page',
|
||||
if (perPage != 10) 'per_page': '$perPage',
|
||||
if (collections != null && collections.isNotEmpty)
|
||||
'collections': '${collections.join(',')}',
|
||||
if (collections.isNotEmpty) 'collections': collections.join(','),
|
||||
if (orientation == SearchPhotosOrientation.landscape)
|
||||
'orientation': 'landscape',
|
||||
if (orientation == SearchPhotosOrientation.portrait)
|
||||
@@ -72,8 +69,8 @@ class Unsplash {
|
||||
if (body is Map &&
|
||||
body['errors'] is List &&
|
||||
body['errors'].isNotEmpty as bool) {
|
||||
final apiError = ApiError.fromJson(response.body);
|
||||
throw UnsplashException(apiError.errors.join(', '));
|
||||
final apiError = ApiError.fromJson(response.body)!;
|
||||
throw UnsplashException(apiError.errors!.join(', '));
|
||||
}
|
||||
|
||||
return SearchPhotosResponse.fromJson(
|
||||
@@ -85,14 +82,14 @@ class Unsplash {
|
||||
// For detail on how downloading photos from Unsplash, please see
|
||||
// https://help.unsplash.com/en/articles/2511258-guideline-triggering-a-download
|
||||
|
||||
_log.info('GET ${photo.urls.full}');
|
||||
final futureBytes = http.readBytes(Uri.parse(photo.urls.full), headers: {
|
||||
_log.info('GET ${photo.urls!.full}');
|
||||
final futureBytes = http.readBytes(Uri.parse(photo.urls!.full!), headers: {
|
||||
'Accept-Version': 'v1',
|
||||
'Authorization': 'Client-ID $_accessKey',
|
||||
});
|
||||
|
||||
_log.info('GET ${photo.links.downloadLocation}');
|
||||
unawaited(http.get(Uri.parse(photo.links.downloadLocation), headers: {
|
||||
_log.info('GET ${photo.links!.downloadLocation}');
|
||||
unawaited(http.get(Uri.parse(photo.links!.downloadLocation!), headers: {
|
||||
'Accept-Version': 'v1',
|
||||
'Authorization': 'Client-ID $_accessKey',
|
||||
}));
|
||||
@@ -110,7 +107,7 @@ enum SearchPhotosOrientation {
|
||||
class UnsplashException implements Exception {
|
||||
UnsplashException([this.message]);
|
||||
|
||||
final String message;
|
||||
final String? message;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -12,35 +12,30 @@ import '../serializers.dart';
|
||||
part 'urls.g.dart';
|
||||
|
||||
abstract class Urls implements Built<Urls, UrlsBuilder> {
|
||||
factory Urls([void Function(UrlsBuilder b) updates]) = _$Urls;
|
||||
factory Urls([void Function(UrlsBuilder b)? updates]) = _$Urls;
|
||||
|
||||
Urls._();
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'raw')
|
||||
String get raw;
|
||||
String? get raw;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'full')
|
||||
String get full;
|
||||
String? get full;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'regular')
|
||||
String get regular;
|
||||
String? get regular;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'small')
|
||||
String get small;
|
||||
String? get small;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'thumb')
|
||||
String get thumb;
|
||||
String? get thumb;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(Urls.serializer, this));
|
||||
}
|
||||
|
||||
static Urls fromJson(String jsonString) {
|
||||
static Urls? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
Urls.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
|
||||
final String wireName = 'Urls';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, Urls object,
|
||||
Iterable<Object?> serialize(Serializers serializers, Urls object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
Object value;
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.raw;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -62,7 +62,7 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
|
||||
}
|
||||
|
||||
@override
|
||||
Urls deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
Urls deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new UrlsBuilder();
|
||||
|
||||
@@ -70,7 +70,7 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'raw':
|
||||
result.raw = serializers.deserialize(value,
|
||||
@@ -101,17 +101,17 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
|
||||
|
||||
class _$Urls extends Urls {
|
||||
@override
|
||||
final String raw;
|
||||
final String? raw;
|
||||
@override
|
||||
final String full;
|
||||
final String? full;
|
||||
@override
|
||||
final String regular;
|
||||
final String? regular;
|
||||
@override
|
||||
final String small;
|
||||
final String? small;
|
||||
@override
|
||||
final String thumb;
|
||||
final String? thumb;
|
||||
|
||||
factory _$Urls([void Function(UrlsBuilder) updates]) =>
|
||||
factory _$Urls([void Function(UrlsBuilder)? updates]) =>
|
||||
(new UrlsBuilder()..update(updates)).build();
|
||||
|
||||
_$Urls._({this.raw, this.full, this.regular, this.small, this.thumb})
|
||||
@@ -156,27 +156,27 @@ class _$Urls extends Urls {
|
||||
}
|
||||
|
||||
class UrlsBuilder implements Builder<Urls, UrlsBuilder> {
|
||||
_$Urls _$v;
|
||||
_$Urls? _$v;
|
||||
|
||||
String _raw;
|
||||
String get raw => _$this._raw;
|
||||
set raw(String raw) => _$this._raw = raw;
|
||||
String? _raw;
|
||||
String? get raw => _$this._raw;
|
||||
set raw(String? raw) => _$this._raw = raw;
|
||||
|
||||
String _full;
|
||||
String get full => _$this._full;
|
||||
set full(String full) => _$this._full = full;
|
||||
String? _full;
|
||||
String? get full => _$this._full;
|
||||
set full(String? full) => _$this._full = full;
|
||||
|
||||
String _regular;
|
||||
String get regular => _$this._regular;
|
||||
set regular(String regular) => _$this._regular = regular;
|
||||
String? _regular;
|
||||
String? get regular => _$this._regular;
|
||||
set regular(String? regular) => _$this._regular = regular;
|
||||
|
||||
String _small;
|
||||
String get small => _$this._small;
|
||||
set small(String small) => _$this._small = small;
|
||||
String? _small;
|
||||
String? get small => _$this._small;
|
||||
set small(String? small) => _$this._small = small;
|
||||
|
||||
String _thumb;
|
||||
String get thumb => _$this._thumb;
|
||||
set thumb(String thumb) => _$this._thumb = thumb;
|
||||
String? _thumb;
|
||||
String? get thumb => _$this._thumb;
|
||||
set thumb(String? thumb) => _$this._thumb = thumb;
|
||||
|
||||
UrlsBuilder();
|
||||
|
||||
@@ -200,7 +200,7 @@ class UrlsBuilder implements Builder<Urls, UrlsBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(UrlsBuilder) updates) {
|
||||
void update(void Function(UrlsBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,16 +13,15 @@ import 'links.dart';
|
||||
part 'user.g.dart';
|
||||
|
||||
abstract class User implements Built<User, UserBuilder> {
|
||||
factory User([void Function(UserBuilder) updates]) = _$User;
|
||||
factory User([void Function(UserBuilder)? updates]) = _$User;
|
||||
|
||||
User._();
|
||||
|
||||
@BuiltValueField(wireName: 'id')
|
||||
String get id;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'updated_at')
|
||||
String get updatedAt;
|
||||
String? get updatedAt;
|
||||
|
||||
@BuiltValueField(wireName: 'username')
|
||||
String get username;
|
||||
@@ -30,39 +29,32 @@ abstract class User implements Built<User, UserBuilder> {
|
||||
@BuiltValueField(wireName: 'name')
|
||||
String get name;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'portfolio_url')
|
||||
String get portfolioUrl;
|
||||
String? get portfolioUrl;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'bio')
|
||||
String get bio;
|
||||
String? get bio;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'location')
|
||||
String get location;
|
||||
String? get location;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'total_likes')
|
||||
int get totalLikes;
|
||||
int? get totalLikes;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'total_photos')
|
||||
int get totalPhotos;
|
||||
int? get totalPhotos;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'total_collections')
|
||||
int get totalCollections;
|
||||
int? get totalCollections;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: 'links')
|
||||
Links get links;
|
||||
Links? get links;
|
||||
|
||||
String toJson() {
|
||||
return json.encode(serializers.serializeWith(User.serializer, this));
|
||||
}
|
||||
|
||||
static User fromJson(String jsonString) {
|
||||
static User? fromJson(String jsonString) {
|
||||
return serializers.deserializeWith(
|
||||
User.serializer, json.decode(jsonString));
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
final String wireName = 'User';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, User object,
|
||||
Iterable<Object?> serialize(Serializers serializers, User object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[
|
||||
final result = <Object?>[
|
||||
'id',
|
||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||
'username',
|
||||
@@ -30,7 +30,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
'name',
|
||||
serializers.serialize(object.name, specifiedType: const FullType(String)),
|
||||
];
|
||||
Object value;
|
||||
Object? value;
|
||||
value = object.updatedAt;
|
||||
if (value != null) {
|
||||
result
|
||||
@@ -88,7 +88,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
}
|
||||
|
||||
@override
|
||||
User deserialize(Serializers serializers, Iterable<Object> serialized,
|
||||
User deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new UserBuilder();
|
||||
|
||||
@@ -96,7 +96,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'id':
|
||||
result.id = serializers.deserialize(value,
|
||||
@@ -140,7 +140,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
|
||||
break;
|
||||
case 'links':
|
||||
result.links.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(Links)) as Links);
|
||||
specifiedType: const FullType(Links))! as Links);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -153,34 +153,34 @@ class _$User extends User {
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String updatedAt;
|
||||
final String? updatedAt;
|
||||
@override
|
||||
final String username;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String portfolioUrl;
|
||||
final String? portfolioUrl;
|
||||
@override
|
||||
final String bio;
|
||||
final String? bio;
|
||||
@override
|
||||
final String location;
|
||||
final String? location;
|
||||
@override
|
||||
final int totalLikes;
|
||||
final int? totalLikes;
|
||||
@override
|
||||
final int totalPhotos;
|
||||
final int? totalPhotos;
|
||||
@override
|
||||
final int totalCollections;
|
||||
final int? totalCollections;
|
||||
@override
|
||||
final Links links;
|
||||
final Links? links;
|
||||
|
||||
factory _$User([void Function(UserBuilder) updates]) =>
|
||||
factory _$User([void Function(UserBuilder)? updates]) =>
|
||||
(new UserBuilder()..update(updates)).build();
|
||||
|
||||
_$User._(
|
||||
{this.id,
|
||||
{required this.id,
|
||||
this.updatedAt,
|
||||
this.username,
|
||||
this.name,
|
||||
required this.username,
|
||||
required this.name,
|
||||
this.portfolioUrl,
|
||||
this.bio,
|
||||
this.location,
|
||||
@@ -261,52 +261,52 @@ class _$User extends User {
|
||||
}
|
||||
|
||||
class UserBuilder implements Builder<User, UserBuilder> {
|
||||
_$User _$v;
|
||||
_$User? _$v;
|
||||
|
||||
String _id;
|
||||
String get id => _$this._id;
|
||||
set id(String id) => _$this._id = id;
|
||||
String? _id;
|
||||
String? get id => _$this._id;
|
||||
set id(String? id) => _$this._id = id;
|
||||
|
||||
String _updatedAt;
|
||||
String get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt;
|
||||
String? _updatedAt;
|
||||
String? get updatedAt => _$this._updatedAt;
|
||||
set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
|
||||
|
||||
String _username;
|
||||
String get username => _$this._username;
|
||||
set username(String username) => _$this._username = username;
|
||||
String? _username;
|
||||
String? get username => _$this._username;
|
||||
set username(String? username) => _$this._username = username;
|
||||
|
||||
String _name;
|
||||
String get name => _$this._name;
|
||||
set name(String name) => _$this._name = name;
|
||||
String? _name;
|
||||
String? get name => _$this._name;
|
||||
set name(String? name) => _$this._name = name;
|
||||
|
||||
String _portfolioUrl;
|
||||
String get portfolioUrl => _$this._portfolioUrl;
|
||||
set portfolioUrl(String portfolioUrl) => _$this._portfolioUrl = portfolioUrl;
|
||||
String? _portfolioUrl;
|
||||
String? get portfolioUrl => _$this._portfolioUrl;
|
||||
set portfolioUrl(String? portfolioUrl) => _$this._portfolioUrl = portfolioUrl;
|
||||
|
||||
String _bio;
|
||||
String get bio => _$this._bio;
|
||||
set bio(String bio) => _$this._bio = bio;
|
||||
String? _bio;
|
||||
String? get bio => _$this._bio;
|
||||
set bio(String? bio) => _$this._bio = bio;
|
||||
|
||||
String _location;
|
||||
String get location => _$this._location;
|
||||
set location(String location) => _$this._location = location;
|
||||
String? _location;
|
||||
String? get location => _$this._location;
|
||||
set location(String? location) => _$this._location = location;
|
||||
|
||||
int _totalLikes;
|
||||
int get totalLikes => _$this._totalLikes;
|
||||
set totalLikes(int totalLikes) => _$this._totalLikes = totalLikes;
|
||||
int? _totalLikes;
|
||||
int? get totalLikes => _$this._totalLikes;
|
||||
set totalLikes(int? totalLikes) => _$this._totalLikes = totalLikes;
|
||||
|
||||
int _totalPhotos;
|
||||
int get totalPhotos => _$this._totalPhotos;
|
||||
set totalPhotos(int totalPhotos) => _$this._totalPhotos = totalPhotos;
|
||||
int? _totalPhotos;
|
||||
int? get totalPhotos => _$this._totalPhotos;
|
||||
set totalPhotos(int? totalPhotos) => _$this._totalPhotos = totalPhotos;
|
||||
|
||||
int _totalCollections;
|
||||
int get totalCollections => _$this._totalCollections;
|
||||
set totalCollections(int totalCollections) =>
|
||||
int? _totalCollections;
|
||||
int? get totalCollections => _$this._totalCollections;
|
||||
set totalCollections(int? totalCollections) =>
|
||||
_$this._totalCollections = totalCollections;
|
||||
|
||||
LinksBuilder _links;
|
||||
LinksBuilder? _links;
|
||||
LinksBuilder get links => _$this._links ??= new LinksBuilder();
|
||||
set links(LinksBuilder links) => _$this._links = links;
|
||||
set links(LinksBuilder? links) => _$this._links = links;
|
||||
|
||||
UserBuilder();
|
||||
|
||||
@@ -336,7 +336,7 @@ class UserBuilder implements Builder<User, UserBuilder> {
|
||||
}
|
||||
|
||||
@override
|
||||
void update(void Function(UserBuilder) updates) {
|
||||
void update(void Function(UserBuilder)? updates) {
|
||||
if (updates != null) updates(this);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ class UserBuilder implements Builder<User, UserBuilder> {
|
||||
totalCollections: totalCollections,
|
||||
links: _links?.build());
|
||||
} catch (_) {
|
||||
String _$failedField;
|
||||
late String _$failedField;
|
||||
try {
|
||||
_$failedField = 'links';
|
||||
_links?.build();
|
||||
|
||||
@@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart' as url_launcher;
|
||||
|
||||
class PolicyDialog extends StatelessWidget {
|
||||
PolicyDialog({
|
||||
Key key,
|
||||
const PolicyDialog({
|
||||
Key? key,
|
||||
this.radius = 8,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -23,7 +23,7 @@ class PolicyDialog extends StatelessWidget {
|
||||
builder: (context) {
|
||||
var height = MediaQuery.of(context).size.height;
|
||||
var width = MediaQuery.of(context).size.width;
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: height / 4,
|
||||
width: width / 4,
|
||||
child: Column(
|
||||
@@ -41,16 +41,16 @@ class PolicyDialog extends StatelessWidget {
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
text: '• ',
|
||||
style: TextStyle(color: Colors.black, fontSize: 18),
|
||||
style: const TextStyle(color: Colors.black, fontSize: 18),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: 'https://policies.google.com/terms',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.lightBlue),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
final url = 'https://policies.google.com/terms';
|
||||
const url = 'https://policies.google.com/terms';
|
||||
if (await url_launcher.canLaunch(url)) {
|
||||
await url_launcher.launch(url);
|
||||
}
|
||||
@@ -63,16 +63,16 @@ class PolicyDialog extends StatelessWidget {
|
||||
textAlign: TextAlign.left,
|
||||
text: TextSpan(
|
||||
text: '• ',
|
||||
style: TextStyle(color: Colors.black, fontSize: 18),
|
||||
style: const TextStyle(color: Colors.black, fontSize: 18),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: 'https://unsplash.com/terms',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.lightBlue),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () async {
|
||||
final url = 'https://unsplash.com/terms';
|
||||
const url = 'https://unsplash.com/terms';
|
||||
if (await url_launcher.canLaunch(url)) {
|
||||
await url_launcher.launch(url);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class PolicyDialog extends StatelessWidget {
|
||||
},
|
||||
child: Text(
|
||||
'CLOSE'.toUpperCase(),
|
||||
style: TextStyle(fontSize: 20),
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
import 'package:url_launcher/link.dart';
|
||||
|
||||
@@ -17,8 +16,8 @@ typedef PhotoDetailsPhotoSaveCallback = void Function(Photo);
|
||||
|
||||
class PhotoDetails extends StatefulWidget {
|
||||
const PhotoDetails({
|
||||
@required this.photo,
|
||||
@required this.onPhotoSave,
|
||||
required this.photo,
|
||||
required this.onPhotoSave,
|
||||
});
|
||||
final Photo photo;
|
||||
final PhotoDetailsPhotoSaveCallback onPhotoSave;
|
||||
@@ -32,21 +31,21 @@ class _PhotoDetailsState extends State<PhotoDetails>
|
||||
Widget _buildPhotoAttribution(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Text('Photo by '),
|
||||
const Text('Photo by '),
|
||||
Link(
|
||||
uri: Uri.parse(
|
||||
'https://unsplash.com/@${widget.photo.user.username}?utm_source=$unsplashAppName&utm_medium=referral'),
|
||||
'https://unsplash.com/@${widget.photo.user!.username}?utm_source=$unsplashAppName&utm_medium=referral'),
|
||||
builder: (context, followLink) => TextButton(
|
||||
onPressed: followLink,
|
||||
child: Text(widget.photo.user.name),
|
||||
child: Text(widget.photo.user!.name),
|
||||
),
|
||||
),
|
||||
Text(' on '),
|
||||
const Text(' on '),
|
||||
Link(
|
||||
uri: _unsplashHomepage,
|
||||
builder: (context, followLink) => TextButton(
|
||||
onPressed: followLink,
|
||||
child: Text('Unsplash'),
|
||||
child: const Text('Unsplash'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -65,22 +64,22 @@ class _PhotoDetailsState extends State<PhotoDetails>
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
shape: ContinuousRectangleBorder(
|
||||
side: BorderSide(color: Colors.black12),
|
||||
side: const BorderSide(color: Colors.black12),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: AnimatedSize(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 750),
|
||||
duration: const Duration(milliseconds: 750),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 40),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 400,
|
||||
minHeight: 400,
|
||||
),
|
||||
child: FadeInImage.memoryNetwork(
|
||||
placeholder: kTransparentImage,
|
||||
image: widget.photo.urls.small,
|
||||
image: widget.photo.urls!.small!,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -97,7 +96,7 @@ class _PhotoDetailsState extends State<PhotoDetails>
|
||||
const SizedBox(width: 8),
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
icon: Icon(Icons.cloud_download),
|
||||
icon: const Icon(Icons.cloud_download),
|
||||
onPressed: () => widget.onPhotoSave(widget.photo),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -24,15 +24,12 @@ import 'package:flutter/material.dart';
|
||||
class Split extends StatefulWidget {
|
||||
/// Builds a split oriented along [axis].
|
||||
const Split({
|
||||
Key key,
|
||||
@required this.axis,
|
||||
@required this.firstChild,
|
||||
@required this.secondChild,
|
||||
double initialFirstFraction,
|
||||
Key? key,
|
||||
required this.axis,
|
||||
required this.firstChild,
|
||||
required this.secondChild,
|
||||
double? initialFirstFraction,
|
||||
}) : initialFirstFraction = initialFirstFraction ?? 0.5,
|
||||
assert(axis != null),
|
||||
assert(firstChild != null),
|
||||
assert(secondChild != null),
|
||||
super(key: key);
|
||||
|
||||
/// The main axis the children will lay out on.
|
||||
@@ -81,7 +78,7 @@ class Split extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SplitState extends State<Split> {
|
||||
double firstFraction;
|
||||
late double firstFraction;
|
||||
|
||||
double get secondFraction => 1 - firstFraction;
|
||||
|
||||
@@ -111,9 +108,8 @@ class _SplitState extends State<Split> {
|
||||
var secondSize = axisSize * secondFraction;
|
||||
|
||||
// Clamp the sizes to be sure there is enough space for the dividers.
|
||||
firstSize = firstSize.clamp(halfDivider, axisSize - halfDivider) as double;
|
||||
secondSize =
|
||||
secondSize.clamp(halfDivider, axisSize - halfDivider) as double;
|
||||
firstSize = firstSize.clamp(halfDivider, axisSize - halfDivider);
|
||||
secondSize = secondSize.clamp(halfDivider, axisSize - halfDivider);
|
||||
|
||||
// Remove space from each child to place the divider in the middle.
|
||||
firstSize = firstSize - halfDivider;
|
||||
@@ -126,7 +122,7 @@ class _SplitState extends State<Split> {
|
||||
// Update the fraction of space consumed by the children,
|
||||
// being sure not to allocate any negative space.
|
||||
firstFraction += fractionalDelta;
|
||||
firstFraction = firstFraction.clamp(0.0, 1.0) as double;
|
||||
firstFraction = firstFraction.clamp(0.0, 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -31,4 +31,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
COCOAPODS: 1.10.1
|
||||
|
||||
@@ -7,28 +7,28 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "14.0.0"
|
||||
version: "22.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.41.2"
|
||||
version: "1.7.1"
|
||||
ansicolor:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ansicolor
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "2.0.1"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
version: "2.1.1"
|
||||
async:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -49,42 +49,42 @@ packages:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.2"
|
||||
version: "2.0.2"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.5"
|
||||
version: "1.0.0"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.10"
|
||||
version: "3.0.0"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.3"
|
||||
version: "2.0.3"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "2.0.4"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.7"
|
||||
version: "7.0.0"
|
||||
built_collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -98,14 +98,14 @@ packages:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.0.3"
|
||||
version: "8.0.6"
|
||||
built_value_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: built_value_generator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.0.3"
|
||||
version: "8.0.6"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -126,14 +126,14 @@ packages:
|
||||
name: checked_yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -147,7 +147,7 @@ packages:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.7.0"
|
||||
version: "4.0.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -175,21 +175,21 @@ packages:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.12"
|
||||
version: "2.0.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -203,7 +203,7 @@ packages:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.2.1"
|
||||
version: "6.1.1"
|
||||
file_selector:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -258,13 +258,20 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_simple_treeview:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_simple_treeview
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
version: "3.0.0-nullsafety.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -275,41 +282,48 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.0.1"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "2.0.0"
|
||||
grinder:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: grinder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.6"
|
||||
version: "0.9.0"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.13.0"
|
||||
version: "0.13.3"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "3.0.1"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -317,20 +331,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
intl:
|
||||
injector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
name: injector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
version: "2.0.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
version: "1.0.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -344,14 +358,21 @@ packages:
|
||||
name: json_annotation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "4.0.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.11.4"
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -364,7 +385,7 @@ packages:
|
||||
description:
|
||||
path: "plugins/menubar"
|
||||
ref: HEAD
|
||||
resolved-ref: "7812516a5c1fc8ef379e244106953a2b534432b9"
|
||||
resolved-ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
|
||||
url: "https://github.com/google/flutter-desktop-embedding.git"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
@@ -388,7 +409,7 @@ packages:
|
||||
name: msix
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.19"
|
||||
version: "2.1.2"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -396,27 +417,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
node_interop:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_interop
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
node_io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.3"
|
||||
version: "2.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -425,7 +432,7 @@ packages:
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
@@ -465,28 +472,28 @@ packages:
|
||||
name: pubspec_parse
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.8"
|
||||
version: "1.0.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.4"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.4+1"
|
||||
version: "1.0.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -498,7 +505,7 @@ packages:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+3"
|
||||
version: "1.0.1"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -554,7 +561,7 @@ packages:
|
||||
name: timing
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1+3"
|
||||
version: "1.0.0"
|
||||
transparent_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -575,7 +582,7 @@ packages:
|
||||
name: url_launcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.2"
|
||||
version: "6.0.6"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -596,14 +603,14 @@ packages:
|
||||
name: url_launcher_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
version: "2.0.3"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -617,7 +624,7 @@ packages:
|
||||
name: uuid
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.4"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -638,14 +645,14 @@ packages:
|
||||
name: web_socket_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.1.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ version: 1.0.0+1
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ^2.11.0
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
flutter: ^2.0.0
|
||||
|
||||
dependencies:
|
||||
@@ -18,14 +18,13 @@ dependencies:
|
||||
file_selector_macos: ^0.0.1
|
||||
file_selector_windows: ^0.0.1
|
||||
http: ^0.13.0
|
||||
logging: ^0.11.3+2
|
||||
flutter_simple_treeview: ^2.0.1
|
||||
logging: ^1.0.1
|
||||
flutter_simple_treeview: ^3.0.0-nullsafety.1
|
||||
menubar:
|
||||
git:
|
||||
url: https://github.com/google/flutter-desktop-embedding.git
|
||||
path: plugins/menubar
|
||||
meta: ^1.1.8
|
||||
pedantic: ^1.9.0
|
||||
provider: ^5.0.0
|
||||
transparent_image: ^2.0.0
|
||||
uuid: ^3.0.1
|
||||
@@ -35,12 +34,13 @@ dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
async: ^2.4.0
|
||||
build: ^1.2.2
|
||||
build_runner: ^1.10.4
|
||||
build: ^2.0.2
|
||||
build_runner: ^2.0.4
|
||||
built_value_generator: ^8.0.3
|
||||
grinder: ^0.8.3
|
||||
msix: ^0.1.5
|
||||
source_gen: ^0.9.4
|
||||
grinder: ^0.9.0
|
||||
msix: ^2.1.2
|
||||
source_gen: ^1.0.1
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -90,7 +90,7 @@ void main() {
|
||||
}
|
||||
''';
|
||||
|
||||
final photo = Photo.fromJson(input);
|
||||
final photo = Photo.fromJson(input)!;
|
||||
expect(photo.id, 'Dwu85P9SOIk');
|
||||
expect(photo.createdAt, '2016-05-03T11:00:28-04:00');
|
||||
expect(photo.updatedAt, '2016-07-10T11:00:01-05:00');
|
||||
@@ -99,12 +99,12 @@ void main() {
|
||||
expect(photo.color, '#6E633A');
|
||||
expect(photo.downloads, 1345);
|
||||
expect(photo.likedByUser, false);
|
||||
expect(photo.exif.make, 'Canon');
|
||||
expect(photo.exif.iso, 100);
|
||||
expect(photo.location.city, 'Montreal');
|
||||
expect(photo.location.country, 'Canada');
|
||||
expect(photo.location.position.latitude, 45.4732984);
|
||||
expect(photo.location.position.longitude, -73.6384879);
|
||||
expect(photo.exif!.make, 'Canon');
|
||||
expect(photo.exif!.iso, 100);
|
||||
expect(photo.location!.city, 'Montreal');
|
||||
expect(photo.location!.country, 'Canada');
|
||||
expect(photo.location!.position!.latitude, 45.4732984);
|
||||
expect(photo.location!.position!.longitude, -73.6384879);
|
||||
});
|
||||
|
||||
test('User.fromJson', () {
|
||||
@@ -149,7 +149,7 @@ void main() {
|
||||
}
|
||||
''';
|
||||
|
||||
final user = User.fromJson(input);
|
||||
final user = User.fromJson(input)!;
|
||||
expect(user.id, 'pXhwzz1JtQU');
|
||||
});
|
||||
|
||||
@@ -207,11 +207,11 @@ void main() {
|
||||
}
|
||||
''';
|
||||
|
||||
final response = SearchPhotosResponse.fromJson(input);
|
||||
final response = SearchPhotosResponse.fromJson(input)!;
|
||||
expect(response.total, 133);
|
||||
expect(response.totalPages, 7);
|
||||
expect(response.results[0].id, 'eOLpJytrbsQ');
|
||||
expect(response.results[0].user.id, 'Ul0QVz12Goo');
|
||||
expect(response.results[0].user!.id, 'Ul0QVz12Goo');
|
||||
});
|
||||
|
||||
group('Unsplash API client', () {
|
||||
@@ -283,12 +283,12 @@ void main() {
|
||||
httpClient: httpClient,
|
||||
);
|
||||
|
||||
final response = await unsplashClient.searchPhotos(query: 'red');
|
||||
final response = (await unsplashClient.searchPhotos(query: 'red'))!;
|
||||
|
||||
expect(response.total, 133);
|
||||
expect(response.totalPages, 7);
|
||||
expect(response.results[0].id, 'eOLpJytrbsQ');
|
||||
expect(response.results[0].user.id, 'Ul0QVz12Goo');
|
||||
expect(response.results[0].user!.id, 'Ul0QVz12Goo');
|
||||
});
|
||||
|
||||
test('handles failure', () async {
|
||||
@@ -525,12 +525,12 @@ void main() {
|
||||
httpClient: httpClient,
|
||||
);
|
||||
|
||||
final response = await unsplashClient.searchPhotos(query: 'red');
|
||||
final response = (await unsplashClient.searchPhotos(query: 'red'))!;
|
||||
|
||||
expect(response.total, 22395);
|
||||
expect(response.totalPages, 2240);
|
||||
expect(response.results[0].id, 'E4u_Zo9PET8');
|
||||
expect(response.results[0].user.id, '_2nQcPrbyuE');
|
||||
expect(response.results[0].user.name, 'Sergiu Vălenaș');
|
||||
expect(response.results[0].user!.id, '_2nQcPrbyuE');
|
||||
expect(response.results[0].user!.name, 'Sergiu Vălenaș');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ class FakeUnsplash implements Unsplash {
|
||||
''';
|
||||
|
||||
@override
|
||||
Future<SearchPhotosResponse> searchPhotos(
|
||||
{String query,
|
||||
Future<SearchPhotosResponse?> searchPhotos(
|
||||
{String? query,
|
||||
num page = 1,
|
||||
num perPage = 10,
|
||||
List<num> collections = const [],
|
||||
SearchPhotosOrientation orientation}) async {
|
||||
SearchPhotosOrientation? orientation}) async {
|
||||
return SearchPhotosResponse.fromJson(searchPhotosResponse);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.11.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -33,19 +33,19 @@ class _HomePageState extends State<HomePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Federated Plugin Demo'),
|
||||
title: const Text('Federated Plugin Demo'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
batteryLevel == null
|
||||
? SizedBox.shrink()
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
'Battery Level: $batteryLevel',
|
||||
style: Theme.of(context).textTheme.headline5,
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
try {
|
||||
@@ -64,7 +64,7 @@ class _HomePageState extends State<HomePage> {
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text('Get Battery Level'),
|
||||
child: const Text('Get Battery Level'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -97,6 +97,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -114,6 +121,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -135,13 +149,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: federated_plugin_example
|
||||
description: Demonstrates how to use the federated_plugin plugin.
|
||||
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
@@ -17,7 +17,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.11.0
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -9,9 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('federated plugin demo tests', () {
|
||||
final batteryLevel = 45;
|
||||
const batteryLevel = 45;
|
||||
setUpAll(() {
|
||||
MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
const MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
if (call.method == 'getBatteryLevel') {
|
||||
return batteryLevel;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -100,6 +107,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -121,13 +135,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
name: federated_plugin
|
||||
description: A new flutter plugin project to demonstrate how to implement federated plugin.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
|
||||
publish_to: 'none'
|
||||
publish_to: "none"
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
@@ -24,7 +23,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.11.0
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
plugin:
|
||||
|
||||
@@ -10,8 +10,8 @@ void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('Federated Plugin Test', () {
|
||||
final batteryLevel = 34;
|
||||
MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
const batteryLevel = 34;
|
||||
const MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
if (call.method == 'getBatteryLevel') {
|
||||
return batteryLevel;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.11.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -7,7 +7,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.6.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -55,11 +55,25 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -81,13 +95,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
plugin_platform_interface:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -141,7 +148,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
version: "0.3.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -17,4 +17,4 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.11.0
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
@@ -10,8 +10,8 @@ void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
group('MethodChannel test', () {
|
||||
final batteryLevel = 89;
|
||||
MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
const batteryLevel = 89;
|
||||
const MethodChannel('battery').setMockMethodCallHandler((call) async {
|
||||
if (call.method == 'getBatteryLevel') {
|
||||
return batteryLevel;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.11.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -7,14 +7,14 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "18.0.0"
|
||||
version: "22.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.7.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -28,14 +28,14 @@ packages:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.1"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.6.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -49,7 +49,7 @@ packages:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -63,7 +63,7 @@ packages:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.0.3"
|
||||
version: "8.0.6"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -98,7 +98,7 @@ packages:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.7.0"
|
||||
version: "4.0.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -119,14 +119,14 @@ packages:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.14"
|
||||
version: "2.0.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -165,6 +165,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -186,7 +193,7 @@ packages:
|
||||
name: glob
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
integration_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -199,13 +206,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -226,7 +240,7 @@ packages:
|
||||
name: mockito
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
version: "5.0.9"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -242,7 +256,7 @@ packages:
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
@@ -268,7 +282,7 @@ packages:
|
||||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
version: "4.2.1"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -287,7 +301,7 @@ packages:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+4"
|
||||
version: "1.0.1"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -336,7 +350,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
version: "0.3.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -357,7 +371,7 @@ packages:
|
||||
name: vm_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.0+1"
|
||||
version: "6.2.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
name: federated_plugin_web
|
||||
description: Web implementation of federated_plugin to retrieve current battery level.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
@@ -21,7 +20,7 @@ dev_dependencies:
|
||||
sdk: flutter
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.11.0
|
||||
flutter_lints: ^1.0.0
|
||||
mockito: ^5.0.2
|
||||
|
||||
flutter:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,16 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_print: false
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
file_names: false
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -28,10 +28,8 @@ class FirebaseEntryApi implements EntryApi {
|
||||
|
||||
@override
|
||||
Stream<List<Entry>> subscribe(String categoryId) {
|
||||
var snapshots = _categoriesRef
|
||||
.document('$categoryId')
|
||||
.collection('entries')
|
||||
.snapshots();
|
||||
var snapshots =
|
||||
_categoriesRef.document(categoryId).collection('entries').snapshots();
|
||||
var result = snapshots.map((querySnapshot) {
|
||||
return querySnapshot.documents.map((snapshot) {
|
||||
return Entry.fromJson(snapshot.data)..id = snapshot.documentID;
|
||||
@@ -54,7 +52,7 @@ class FirebaseEntryApi implements EntryApi {
|
||||
@override
|
||||
Future<Entry> insert(String categoryId, Entry entry) async {
|
||||
var document = await _categoriesRef
|
||||
.document('$categoryId')
|
||||
.document(categoryId)
|
||||
.collection('entries')
|
||||
.add(entry.toJson());
|
||||
return await get(categoryId, document.documentID);
|
||||
@@ -62,8 +60,7 @@ class FirebaseEntryApi implements EntryApi {
|
||||
|
||||
@override
|
||||
Future<List<Entry>> list(String categoryId) async {
|
||||
var entriesRef =
|
||||
_categoriesRef.document('$categoryId').collection('entries');
|
||||
var entriesRef = _categoriesRef.document(categoryId).collection('entries');
|
||||
var querySnapshot = await entriesRef.getDocuments();
|
||||
var entries = querySnapshot.documents
|
||||
.map((doc) => Entry.fromJson(doc.data)..id = doc.documentID)
|
||||
@@ -110,7 +107,7 @@ class FirebaseCategoryApi implements CategoryApi {
|
||||
|
||||
@override
|
||||
Future<Category> delete(String id) async {
|
||||
var document = _categoriesRef.document('$id');
|
||||
var document = _categoriesRef.document(id);
|
||||
var categories = await get(document.documentID);
|
||||
|
||||
await document.delete();
|
||||
@@ -120,7 +117,7 @@ class FirebaseCategoryApi implements CategoryApi {
|
||||
|
||||
@override
|
||||
Future<Category> get(String id) async {
|
||||
var document = _categoriesRef.document('$id');
|
||||
var document = _categoriesRef.document(id);
|
||||
var snapshot = await document.get();
|
||||
return Category.fromJson(snapshot.data)..id = snapshot.documentID;
|
||||
}
|
||||
@@ -143,7 +140,7 @@ class FirebaseCategoryApi implements CategoryApi {
|
||||
|
||||
@override
|
||||
Future<Category> update(Category category, String id) async {
|
||||
var document = _categoriesRef.document('$id');
|
||||
var document = _categoriesRef.document(id);
|
||||
await document.setData(category.toJson());
|
||||
var snapshot = await document.get();
|
||||
return Category.fromJson(snapshot.data)..id = snapshot.documentID;
|
||||
|
||||
@@ -20,11 +20,11 @@ class MockDashboardApi implements DashboardApi {
|
||||
|
||||
/// Creates a [MockDashboardApi] filled with mock data for the last 30 days.
|
||||
Future<void> fillWithMockData() async {
|
||||
await Future<void>.delayed(Duration(seconds: 1));
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
var category1 = await categories.insert(Category('Coffee (oz)'));
|
||||
var category2 = await categories.insert(Category('Running (miles)'));
|
||||
var category3 = await categories.insert(Category('Git Commits'));
|
||||
var monthAgo = DateTime.now().subtract(Duration(days: 30));
|
||||
var monthAgo = DateTime.now().subtract(const Duration(days: 30));
|
||||
|
||||
for (var category in [category1, category2, category3]) {
|
||||
for (var i = 0; i < 30; i++) {
|
||||
@@ -37,8 +37,8 @@ class MockDashboardApi implements DashboardApi {
|
||||
}
|
||||
|
||||
class MockCategoryApi implements CategoryApi {
|
||||
Map<String, Category> _storage = {};
|
||||
StreamController<List<Category>> _streamController =
|
||||
final Map<String, Category> _storage = {};
|
||||
final StreamController<List<Category>> _streamController =
|
||||
StreamController<List<Category>>.broadcast();
|
||||
|
||||
@override
|
||||
@@ -74,6 +74,7 @@ class MockCategoryApi implements CategoryApi {
|
||||
return category..id = id;
|
||||
}
|
||||
|
||||
@override
|
||||
Stream<List<Category>> subscribe() => _streamController.stream;
|
||||
|
||||
void _emit() {
|
||||
@@ -82,8 +83,8 @@ class MockCategoryApi implements CategoryApi {
|
||||
}
|
||||
|
||||
class MockEntryApi implements EntryApi {
|
||||
Map<String, Entry> _storage = {};
|
||||
StreamController<_EntriesEvent> _streamController =
|
||||
final Map<String, Entry> _storage = {};
|
||||
final StreamController<_EntriesEvent> _streamController =
|
||||
StreamController.broadcast();
|
||||
|
||||
@override
|
||||
|
||||
@@ -26,14 +26,14 @@ class AppState {
|
||||
/// Creates a [DashboardApi] for the given user. This allows users of this
|
||||
/// widget to specify whether [MockDashboardApi] or [ApiBuilder] should be
|
||||
/// created when the user logs in.
|
||||
typedef DashboardApi ApiBuilder(User user);
|
||||
typedef ApiBuilder = DashboardApi Function(User user);
|
||||
|
||||
/// An app that displays a personalized dashboard.
|
||||
class DashboardApp extends StatefulWidget {
|
||||
static ApiBuilder _mockApiBuilder =
|
||||
(user) => MockDashboardApi()..fillWithMockData();
|
||||
static ApiBuilder _apiBuilder =
|
||||
(user) => FirebaseDashboardApi(Firestore.instance, user.uid);
|
||||
static DashboardApi _mockApiBuilder(User user) =>
|
||||
MockDashboardApi()..fillWithMockData();
|
||||
static DashboardApi _apiBuilder(User user) =>
|
||||
FirebaseDashboardApi(Firestore.instance, user.uid);
|
||||
|
||||
final Auth auth;
|
||||
final ApiBuilder apiBuilder;
|
||||
@@ -55,6 +55,7 @@ class DashboardApp extends StatefulWidget {
|
||||
class _DashboardAppState extends State<DashboardApp> {
|
||||
AppState _appState;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_appState = AppState(widget.auth);
|
||||
@@ -80,7 +81,7 @@ class SignInSwitcher extends StatefulWidget {
|
||||
final AppState appState;
|
||||
final ApiBuilder apiBuilder;
|
||||
|
||||
SignInSwitcher({
|
||||
const SignInSwitcher({
|
||||
this.appState,
|
||||
this.apiBuilder,
|
||||
});
|
||||
@@ -97,7 +98,7 @@ class _SignInSwitcherState extends State<SignInSwitcher> {
|
||||
return AnimatedSwitcher(
|
||||
switchInCurve: Curves.easeOut,
|
||||
switchOutCurve: Curves.easeOut,
|
||||
duration: Duration(milliseconds: 200),
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: _isSignedIn
|
||||
? HomePage(
|
||||
onSignOut: _handleSignOut,
|
||||
|
||||
@@ -12,8 +12,10 @@ class FirebaseAuthService implements Auth {
|
||||
final GoogleSignIn _googleSignIn = GoogleSignIn();
|
||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||
|
||||
@override
|
||||
Future<bool> get isSignedIn => _googleSignIn.isSignedIn();
|
||||
|
||||
@override
|
||||
Future<User> signIn() async {
|
||||
try {
|
||||
return await _signIn();
|
||||
@@ -41,6 +43,7 @@ class FirebaseAuthService implements Auth {
|
||||
return _FirebaseUser(authResult.user.uid);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
await Future.wait([
|
||||
_auth.signOut(),
|
||||
@@ -50,6 +53,7 @@ class FirebaseAuthService implements Auth {
|
||||
}
|
||||
|
||||
class _FirebaseUser implements User {
|
||||
@override
|
||||
final String uid;
|
||||
|
||||
_FirebaseUser(this.uid);
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'dart:math';
|
||||
import 'auth.dart';
|
||||
|
||||
class MockAuthService implements Auth {
|
||||
@override
|
||||
Future<bool> get isSignedIn async => false;
|
||||
|
||||
@override
|
||||
@@ -26,5 +27,6 @@ class MockAuthService implements Auth {
|
||||
}
|
||||
|
||||
class MockUser implements User {
|
||||
@override
|
||||
String get uid => "123";
|
||||
}
|
||||
|
||||
@@ -10,13 +10,14 @@ import '../app.dart';
|
||||
import '../widgets/category_chart.dart';
|
||||
|
||||
class DashboardPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var appState = Provider.of<AppState>(context);
|
||||
return FutureBuilder<List<Category>>(
|
||||
future: appState.api.categories.list(),
|
||||
builder: (context, futureSnapshot) {
|
||||
if (!futureSnapshot.hasData) {
|
||||
return Center(
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
@@ -25,7 +26,7 @@ class DashboardPage extends StatelessWidget {
|
||||
stream: appState.api.categories.subscribe(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == null) {
|
||||
return Center(
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
@@ -40,14 +41,14 @@ class DashboardPage extends StatelessWidget {
|
||||
class Dashboard extends StatelessWidget {
|
||||
final List<Category> categories;
|
||||
|
||||
Dashboard(this.categories);
|
||||
const Dashboard(this.categories);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var api = Provider.of<AppState>(context).api;
|
||||
return Scrollbar(
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
childAspectRatio: 2,
|
||||
maxCrossAxisExtent: 500,
|
||||
),
|
||||
|
||||
@@ -29,7 +29,7 @@ class _EntriesPageState extends State<EntriesPage> {
|
||||
onSelected: (category) => setState(() => _selected = category)),
|
||||
Expanded(
|
||||
child: _selected == null
|
||||
? Center(child: CircularProgressIndicator())
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: EntriesList(
|
||||
category: _selected,
|
||||
api: appState.api.entries,
|
||||
@@ -89,7 +89,7 @@ class _EntriesListState extends State<EntriesList> {
|
||||
}
|
||||
|
||||
Widget _buildLoadingIndicator() {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class EntryTile extends StatelessWidget {
|
||||
final Category category;
|
||||
final Entry entry;
|
||||
|
||||
EntryTile({
|
||||
const EntryTile({
|
||||
this.category,
|
||||
this.entry,
|
||||
});
|
||||
@@ -111,7 +111,7 @@ class EntryTile extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text('Edit'),
|
||||
child: const Text('Edit'),
|
||||
onPressed: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
@@ -122,19 +122,19 @@ class EntryTile extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Delete'),
|
||||
child: const Text('Delete'),
|
||||
onPressed: () async {
|
||||
var shouldDelete = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Delete entry?'),
|
||||
title: const Text('Delete entry?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text('Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Delete'),
|
||||
child: const Text('Delete'),
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
),
|
||||
],
|
||||
@@ -147,7 +147,7 @@ class EntryTile extends StatelessWidget {
|
||||
.delete(category.id, entry.id);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Entry deleted'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'entries.dart';
|
||||
class HomePage extends StatefulWidget {
|
||||
final VoidCallback onSignOut;
|
||||
|
||||
HomePage({
|
||||
const HomePage({
|
||||
@required this.onSignOut,
|
||||
});
|
||||
|
||||
@@ -26,19 +26,19 @@ class _HomePageState extends State<HomePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AdaptiveScaffold(
|
||||
title: Text('Dashboard App'),
|
||||
title: const Text('Dashboard App'),
|
||||
actions: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextButton(
|
||||
style: TextButton.styleFrom(primary: Colors.white),
|
||||
onPressed: () => _handleSignOut(),
|
||||
child: Text('Sign Out'),
|
||||
child: const Text('Sign Out'),
|
||||
),
|
||||
)
|
||||
],
|
||||
currentIndex: _pageIndex,
|
||||
destinations: [
|
||||
destinations: const [
|
||||
AdaptiveScaffoldDestination(title: 'Home', icon: Icons.home),
|
||||
AdaptiveScaffoldDestination(title: 'Entries', icon: Icons.list),
|
||||
AdaptiveScaffoldDestination(title: 'Settings', icon: Icons.settings),
|
||||
@@ -61,7 +61,7 @@ class _HomePageState extends State<HomePage> {
|
||||
|
||||
FloatingActionButton _buildFab(BuildContext context) {
|
||||
return FloatingActionButton(
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () => _handleFabPressed(),
|
||||
);
|
||||
}
|
||||
@@ -88,16 +88,16 @@ class _HomePageState extends State<HomePage> {
|
||||
var shouldSignOut = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Are you sure you want to sign out?'),
|
||||
title: const Text('Are you sure you want to sign out?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
child: const Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
child: const Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
@@ -122,6 +122,6 @@ class _HomePageState extends State<HomePage> {
|
||||
return EntriesPage();
|
||||
}
|
||||
|
||||
return Center(child: Text('Settings page'));
|
||||
return const Center(child: Text('Settings page'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class SignInPage extends StatelessWidget {
|
||||
final Auth auth;
|
||||
final ValueChanged<User> onSuccess;
|
||||
|
||||
SignInPage({
|
||||
const SignInPage({
|
||||
@required this.auth,
|
||||
@required this.onSuccess,
|
||||
});
|
||||
@@ -29,7 +29,7 @@ class SignInButton extends StatefulWidget {
|
||||
final Auth auth;
|
||||
final ValueChanged<User> onSuccess;
|
||||
|
||||
SignInButton({
|
||||
const SignInButton({
|
||||
@required this.auth,
|
||||
@required this.onSuccess,
|
||||
});
|
||||
@@ -78,7 +78,7 @@ class _SignInButtonState extends State<SignInButton> {
|
||||
var alreadySignedIn = snapshot.data;
|
||||
if (snapshot.connectionState != ConnectionState.done ||
|
||||
alreadySignedIn == true) {
|
||||
return CircularProgressIndicator();
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
|
||||
// If sign in failed, show toast and the login button
|
||||
@@ -87,7 +87,7 @@ class _SignInButtonState extends State<SignInButton> {
|
||||
}
|
||||
|
||||
return ElevatedButton(
|
||||
child: Text('Sign In with Google'),
|
||||
child: const Text('Sign In with Google'),
|
||||
onPressed: () => _signIn(),
|
||||
);
|
||||
},
|
||||
@@ -96,7 +96,7 @@ class _SignInButtonState extends State<SignInButton> {
|
||||
|
||||
void _showError() {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Unable to sign in.'),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -60,6 +60,6 @@ Iterable<List<Entry>> _entriesInRangeImpl(
|
||||
}
|
||||
|
||||
yield es;
|
||||
d = d.add(Duration(days: 1));
|
||||
d = d.add(const Duration(days: 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ extension DayUtils on DateTime {
|
||||
|
||||
/// Checks that the two [DateTime]s share the same date.
|
||||
bool isSameDay(DateTime d2) {
|
||||
return this.year == d2.year && this.month == d2.month && this.day == d2.day;
|
||||
return year == d2.year && month == d2.month && day == d2.day;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class CategoryDropdown extends StatefulWidget {
|
||||
final CategoryApi api;
|
||||
final ValueChanged<Category> onSelected;
|
||||
|
||||
CategoryDropdown({
|
||||
const CategoryDropdown({
|
||||
@required this.api,
|
||||
@required this.onSelected,
|
||||
});
|
||||
@@ -27,6 +27,7 @@ class _CategoryDropdownState extends State<CategoryDropdown> {
|
||||
Future<List<Category>> _future;
|
||||
Stream<List<Category>> _stream;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
@@ -69,7 +70,7 @@ class _CategoryDropdownState extends State<CategoryDropdown> {
|
||||
builder: (context, futureSnapshot) {
|
||||
// Show an empty dropdown while the data is loading.
|
||||
if (!futureSnapshot.hasData) {
|
||||
return DropdownButton<Category>(items: [], onChanged: null);
|
||||
return DropdownButton<Category>(items: const [], onChanged: null);
|
||||
}
|
||||
|
||||
return StreamBuilder<List<Category>>(
|
||||
|
||||
@@ -18,11 +18,12 @@ class CategoryChart extends StatelessWidget {
|
||||
final Category category;
|
||||
final DashboardApi api;
|
||||
|
||||
CategoryChart({
|
||||
const CategoryChart({
|
||||
@required this.category,
|
||||
@required this.api,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
@@ -33,7 +34,7 @@ class CategoryChart extends StatelessWidget {
|
||||
children: [
|
||||
Text(category.name),
|
||||
IconButton(
|
||||
icon: Icon(Icons.settings),
|
||||
icon: const Icon(Icons.settings),
|
||||
onPressed: () {
|
||||
showDialog<EditCategoryDialog>(
|
||||
context: context,
|
||||
@@ -73,14 +74,14 @@ class CategoryChart extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildLoadingIndicator() {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
}
|
||||
|
||||
class _BarChart extends StatelessWidget {
|
||||
final List<Entry> entries;
|
||||
|
||||
_BarChart({this.entries});
|
||||
const _BarChart({this.entries});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -13,7 +13,7 @@ class NewCategoryForm extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _NewCategoryFormState extends State<NewCategoryForm> {
|
||||
Category _category = Category('');
|
||||
final Category _category = Category('');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -34,7 +34,7 @@ class EditCategoryForm extends StatefulWidget {
|
||||
final Category category;
|
||||
final ValueChanged<bool> onDone;
|
||||
|
||||
EditCategoryForm({
|
||||
const EditCategoryForm({
|
||||
@required this.category,
|
||||
@required this.onDone,
|
||||
});
|
||||
@@ -57,7 +57,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: TextFormField(
|
||||
initialValue: widget.category.name,
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Name',
|
||||
),
|
||||
onChanged: (newValue) {
|
||||
@@ -77,7 +77,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
child: ElevatedButton(
|
||||
child: Text('Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
onPressed: () {
|
||||
widget.onDone(false);
|
||||
},
|
||||
@@ -86,7 +86,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
child: ElevatedButton(
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
widget.onDone(true);
|
||||
|
||||
@@ -14,7 +14,7 @@ class NewCategoryDialog extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: Text('New Category'),
|
||||
title: const Text('New Category'),
|
||||
children: <Widget>[
|
||||
NewCategoryForm(),
|
||||
],
|
||||
@@ -25,7 +25,7 @@ class NewCategoryDialog extends StatelessWidget {
|
||||
class EditCategoryDialog extends StatelessWidget {
|
||||
final Category category;
|
||||
|
||||
EditCategoryDialog({
|
||||
const EditCategoryDialog({
|
||||
@required this.category,
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ class EditCategoryDialog extends StatelessWidget {
|
||||
var api = Provider.of<AppState>(context).api;
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text('Edit Category'),
|
||||
title: const Text('Edit Category'),
|
||||
children: [
|
||||
EditCategoryForm(
|
||||
category: category,
|
||||
@@ -59,7 +59,7 @@ class _NewEntryDialogState extends State<NewEntryDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SimpleDialog(
|
||||
title: Text('New Entry'),
|
||||
title: const Text('New Entry'),
|
||||
children: [
|
||||
NewEntryForm(),
|
||||
],
|
||||
@@ -71,7 +71,7 @@ class EditEntryDialog extends StatelessWidget {
|
||||
final Category category;
|
||||
final Entry entry;
|
||||
|
||||
EditEntryDialog({
|
||||
const EditEntryDialog({
|
||||
this.category,
|
||||
this.entry,
|
||||
});
|
||||
@@ -81,7 +81,7 @@ class EditEntryDialog extends StatelessWidget {
|
||||
var api = Provider.of<AppState>(context).api;
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text('Edit Entry'),
|
||||
title: const Text('Edit Entry'),
|
||||
children: [
|
||||
EditEntryForm(
|
||||
entry: entry,
|
||||
|
||||
@@ -17,7 +17,7 @@ class NewEntryForm extends StatefulWidget {
|
||||
|
||||
class _NewEntryFormState extends State<NewEntryForm> {
|
||||
Category _selected;
|
||||
Entry _entry = Entry(0, DateTime.now());
|
||||
final Entry _entry = Entry(0, DateTime.now());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -55,7 +55,7 @@ class EditEntryForm extends StatefulWidget {
|
||||
final Entry entry;
|
||||
final ValueChanged<bool> onDone;
|
||||
|
||||
EditEntryForm({
|
||||
const EditEntryForm({
|
||||
@required this.entry,
|
||||
@required this.onDone,
|
||||
});
|
||||
@@ -75,10 +75,10 @@ class _EditEntryFormState extends State<EditEntryForm> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: TextFormField(
|
||||
initialValue: widget.entry.value.toString(),
|
||||
decoration: InputDecoration(labelText: 'Value'),
|
||||
decoration: const InputDecoration(labelText: 'Value'),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
try {
|
||||
@@ -98,18 +98,19 @@ class _EditEntryFormState extends State<EditEntryForm> {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(intl.DateFormat('MM/dd/yyyy').format(widget.entry.time)),
|
||||
ElevatedButton(
|
||||
child: Text('Edit'),
|
||||
child: const Text('Edit'),
|
||||
onPressed: () async {
|
||||
var result = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: widget.entry.time,
|
||||
firstDate: DateTime.now().subtract(Duration(days: 365)),
|
||||
firstDate:
|
||||
DateTime.now().subtract(const Duration(days: 365)),
|
||||
lastDate: DateTime.now());
|
||||
if (result == null) {
|
||||
return;
|
||||
@@ -128,7 +129,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
child: ElevatedButton(
|
||||
child: Text('Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
onPressed: () {
|
||||
widget.onDone(false);
|
||||
},
|
||||
@@ -137,7 +138,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
child: ElevatedButton(
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
widget.onDone(true);
|
||||
|
||||
@@ -35,7 +35,7 @@ class AdaptiveScaffold extends StatefulWidget {
|
||||
final ValueChanged<int> onNavigationIndexChange;
|
||||
final FloatingActionButton floatingActionButton;
|
||||
|
||||
AdaptiveScaffold({
|
||||
const AdaptiveScaffold({
|
||||
this.title,
|
||||
this.body,
|
||||
this.actions = const [],
|
||||
|
||||
@@ -84,14 +84,14 @@ packages:
|
||||
name: built_collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.3.2"
|
||||
version: "5.0.0"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.1.0"
|
||||
version: "8.0.6"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -133,7 +133,7 @@ packages:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -252,14 +252,14 @@ packages:
|
||||
name: firebase_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.5"
|
||||
version: "0.4.4"
|
||||
firebase_core_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: firebase_core_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.0"
|
||||
firebase_core_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -273,12 +273,19 @@ packages:
|
||||
name: fixnum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.11"
|
||||
version: "1.0.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -302,21 +309,21 @@ packages:
|
||||
name: google_sign_in
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.5.9"
|
||||
version: "5.0.4"
|
||||
google_sign_in_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "2.0.1"
|
||||
google_sign_in_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.2"
|
||||
version: "0.10.0"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -387,6 +394,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.5.1"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -456,7 +470,7 @@ packages:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.3"
|
||||
version: "1.11.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -498,7 +512,14 @@ packages:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
version: "3.0.1"
|
||||
quiver_hashcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver_hashcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -524,7 +545,7 @@ packages:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+1"
|
||||
version: "0.9.10+3"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -625,4 +646,4 @@ packages:
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.16.0"
|
||||
flutter: ">=1.20.0"
|
||||
|
||||
@@ -10,7 +10,7 @@ dependencies:
|
||||
cupertino_icons: ^0.1.2
|
||||
firebase_auth: ^0.16.1
|
||||
firebase_core: ^0.4.3
|
||||
google_sign_in: ^4.4 0
|
||||
google_sign_in: ^5.0.0
|
||||
json_annotation: ^3.0.0
|
||||
provider: ^4.0.0
|
||||
uuid: ^2.0.0
|
||||
@@ -21,5 +21,6 @@ dev_dependencies:
|
||||
build_runner: ^1.8.0
|
||||
json_serializable: ^3.3.0
|
||||
grinder: ^0.8.4
|
||||
flutter_lints: ^1.0.0
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -95,7 +95,7 @@ Stream<File> _filesWithoutCopyright() async* {
|
||||
var firstThreeLines = await file
|
||||
.openRead()
|
||||
.transform(utf8.decoder)
|
||||
.transform(LineSplitter())
|
||||
.transform(const LineSplitter())
|
||||
.take(3)
|
||||
.fold<String>('', (previous, element) {
|
||||
if (previous == '') return element;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
@@ -7,25 +7,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -76,7 +76,7 @@ class _HomePageState extends State<HomePage> {
|
||||
return Center(child: Text('Error: ${snapshot.error}'));
|
||||
}
|
||||
if (!snapshot.hasData) {
|
||||
return Center(child: const Text('Loading...'));
|
||||
return const Center(child: Text('Loading...'));
|
||||
}
|
||||
|
||||
return Stack(
|
||||
@@ -211,7 +211,7 @@ class _StoreListTileState extends State<StoreListTile> {
|
||||
return ListTile(
|
||||
title: Text(widget.document['name'] as String),
|
||||
subtitle: Text(widget.document['address'] as String),
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: _placePhotoUrl.isNotEmpty
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user