Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeiffer committed Nov 16, 2023
1 parent 6360e46 commit db8726a
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 31 deletions.
18 changes: 10 additions & 8 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import 'src/network_svg_page.dart';
import 'src/string_svg_page.dart';

void main() {
runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
Expand All @@ -19,13 +21,13 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
home: const MyHomePage(),
);
}
}

class MyHomePage extends StatelessWidget {
MyHomePage({Key? key}) : super(key: key);
const MyHomePage({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -38,39 +40,39 @@ class MyHomePage extends StatelessWidget {
ListTile(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => AnimationPage(),
builder: (BuildContext context) => const AnimationPage(),
),
),
title: const Text('Animation'),
),
ListTile(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => AssetSvgPage(),
builder: (BuildContext context) => const AssetSvgPage(),
),
),
title: const Text('Assets'),
),
ListTile(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => MemorySvgPage(),
builder: (BuildContext context) => const MemorySvgPage(),
),
),
title: const Text('Memory'),
),
ListTile(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => NetworkSvgPage(),
builder: (BuildContext context) => const NetworkSvgPage(),
),
),
title: const Text('Network'),
),
ListTile(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => StringSvgPage(),
builder: (BuildContext context) => const StringSvgPage(),
),
),
title: const Text('String'),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/animation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:websafe_svg/websafe_svg.dart';

class AnimationPage extends StatefulWidget {
AnimationPage({super.key});
const AnimationPage({super.key});

@override
_AnimationPageState createState() => _AnimationPageState();
State createState() => _AnimationPageState();
}

class _AnimationPageState extends State<AnimationPage>
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/asset_svg_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import 'package:websafe_svg/websafe_svg.dart';
import 'package:websafe_svg_example/src/svg_page.dart';

class AssetSvgPage extends StatefulWidget {
AssetSvgPage({super.key});
const AssetSvgPage({super.key});

@override
_AssetSvgPageState createState() => _AssetSvgPageState();
State createState() => _AssetSvgPageState();
}

class _AssetSvgPageState extends State<AssetSvgPage> {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/src/memory_svg_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'package:websafe_svg/websafe_svg.dart';
import 'package:websafe_svg_example/src/svg_page.dart';

class MemorySvgPage extends StatefulWidget {
MemorySvgPage({
const MemorySvgPage({
super.key,
});

@override
_MemorySvgPageState createState() => _MemorySvgPageState();
State createState() => _MemorySvgPageState();
}

class _MemorySvgPageState extends State<MemorySvgPage> {
Expand Down Expand Up @@ -107,7 +107,7 @@ class _MemorySvgPageState extends State<MemorySvgPage> {

@immutable
class _SvgImage {
_SvgImage({
const _SvgImage({
required this.image,
required this.name,
});
Expand Down
4 changes: 2 additions & 2 deletions example/lib/src/network_svg_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'package:websafe_svg/websafe_svg.dart';
import 'package:websafe_svg_example/src/svg_page.dart';

class NetworkSvgPage extends StatefulWidget {
NetworkSvgPage({
const NetworkSvgPage({
super.key,
});

@override
_NetworkSvgPageState createState() => _NetworkSvgPageState();
State createState() => _NetworkSvgPageState();
}

class _NetworkSvgPageState extends State<NetworkSvgPage> {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/src/string_svg_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'package:websafe_svg/websafe_svg.dart';
import 'package:websafe_svg_example/src/svg_page.dart';

class StringSvgPage extends StatefulWidget {
StringSvgPage({
const StringSvgPage({
super.key,
});

@override
_StringSvgPageState createState() => _StringSvgPageState();
State createState() => _StringSvgPageState();
}

class _StringSvgPageState extends State<StringSvgPage> {
Expand Down Expand Up @@ -103,7 +103,7 @@ class _StringSvgPageState extends State<StringSvgPage> {

@immutable
class _SvgImage {
_SvgImage({
const _SvgImage({
required this.image,
required this.name,
});
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/svg_page.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class SvgPage extends StatelessWidget {
SvgPage({
const SvgPage({
super.key,
required this.child,
});
Expand Down
2 changes: 1 addition & 1 deletion example/scripts/create_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ void main() async {
}

final out = File('assets/all.json');
final encoder = const JsonEncoder.withIndent(' ');
const encoder = JsonEncoder.withIndent(' ');
out.writeAsStringSync(encoder.convert(all));
}
10 changes: 6 additions & 4 deletions lib/src/platform/browser/browser_svg.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: avoid_web_libraries_in_flutter

import 'dart:convert';
import 'dart:js' as js;
import 'dart:typed_data';
Expand All @@ -8,22 +10,22 @@ import 'package:logging/logging.dart';
import 'package:websafe_svg/src/platform/browser/browser_svg_loader.dart';

class BrowserSvg extends StatefulWidget {
BrowserSvg({
const BrowserSvg({
required this.alignment,
this.allowDrawingOutsideViewBox = false,
this.clipBehavior = Clip.hardEdge,
this.colorFilter,
required this.excludeFromSemantics,
required this.fit,
required this.height,
Key? key,
super.key,
required this.loader,
this.matchTextDirection = false,
required this.placeholderBuilder,
required this.semanticsLabel,
this.theme,
required this.width,
}) : super(key: key);
});

final Alignment alignment;
final bool allowDrawingOutsideViewBox;
Expand All @@ -40,7 +42,7 @@ class BrowserSvg extends StatefulWidget {
final double? width;

@override
_BrowserSvgState createState() => _BrowserSvgState();
State createState() => _BrowserSvgState();
}

class _BrowserSvgState extends State<BrowserSvg> {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/browser/browser_svg_asset_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:websafe_svg/src/platform/browser/browser_svg_loader.dart';

@immutable
class BrowserSvgAssetLoader implements BrowserSvgLoader {
BrowserSvgAssetLoader({
const BrowserSvgAssetLoader({
required this.asset,
this.package,
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/browser/browser_svg_memory_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:websafe_svg/src/platform/browser/browser_svg_loader.dart';

@immutable
class BrowserSvgMemoryLoader implements BrowserSvgLoader {
BrowserSvgMemoryLoader({
const BrowserSvgMemoryLoader({
required this.bytes,
});

Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/browser/browser_svg_network_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:websafe_svg/src/platform/browser/browser_svg_loader.dart';

@immutable
class BrowserSvgNetworkLoader implements BrowserSvgLoader {
BrowserSvgNetworkLoader({
const BrowserSvgNetworkLoader({
this.headers,
required this.url,
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/platform/browser/browser_svg_string_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:websafe_svg/src/platform/browser/browser_svg_loader.dart';

@immutable
class BrowserSvgStringLoader implements BrowserSvgLoader {
BrowserSvgStringLoader({
const BrowserSvgStringLoader({
required this.string,
});

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: '>=3.0.0 <4.0.0'

dependencies:
convert: '^3.1.5'
convert: '^3.1.1'
flutter:
sdk: 'flutter'
flutter_svg: '^2.0.9'
Expand Down

0 comments on commit db8726a

Please sign in to comment.