-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- A "this." parameter can implicitly introduce a new field if there isn't already a field with its name. If so, the field's type is the same as the parameter's. - The constructor doesn't have to repeat the class name and can instead be just "const" or "new".
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,19 @@ | |
import 'package:flutter/material.dart'; | ||
|
||
class CodeStyle extends InheritedWidget { | ||
const CodeStyle({ | ||
const ({ | ||
super.key, | ||
this.baseStyle, | ||
this.numberStyle, | ||
this.commentStyle, | ||
this.keywordStyle, | ||
this.stringStyle, | ||
this.punctuationStyle, | ||
this.classStyle, | ||
this.constantStyle, | ||
final TextStyle? this.baseStyle, | ||
final TextStyle? this.numberStyle, | ||
final TextStyle? this.commentStyle, | ||
final TextStyle? this.keywordStyle, | ||
final TextStyle? this.stringStyle, | ||
final TextStyle? this.punctuationStyle, | ||
final TextStyle? this.classStyle, | ||
final TextStyle? this.constantStyle, | ||
required super.child, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
leafpetersen
|
||
}); | ||
|
||
final TextStyle? baseStyle; | ||
final TextStyle? numberStyle; | ||
final TextStyle? commentStyle; | ||
final TextStyle? keywordStyle; | ||
final TextStyle? stringStyle; | ||
final TextStyle? punctuationStyle; | ||
final TextStyle? classStyle; | ||
final TextStyle? constantStyle; | ||
|
||
static CodeStyle of(BuildContext context) { | ||
return context.dependOnInheritedWidgetOfExactType<CodeStyle>()!; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; | |
// BEGIN cupertinoActivityIndicatorDemo | ||
|
||
class CupertinoProgressIndicatorDemo extends StatelessWidget { | ||
const CupertinoProgressIndicatorDemo({super.key}); | ||
const ({super.key}); | ||
This comment has been minimized.
Sorry, something went wrong.
leafpetersen
|
||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,11 @@ import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; | |
// BEGIN cupertinoNavigationDemo | ||
|
||
class _TabInfo { | ||
const _TabInfo(this.title, this.icon); | ||
This comment has been minimized.
Sorry, something went wrong.
leafpetersen
|
||
|
||
final String title; | ||
final IconData icon; | ||
const (final String this.title, final IconData this.icon); | ||
} | ||
|
||
class CupertinoTabBarDemo extends StatelessWidget { | ||
const CupertinoTabBarDemo({super.key}); | ||
const ({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
|
@@ -65,14 +62,11 @@ class CupertinoTabBarDemo extends StatelessWidget { | |
} | ||
|
||
class _CupertinoDemoTab extends StatelessWidget { | ||
const _CupertinoDemoTab({ | ||
required this.title, | ||
required this.icon, | ||
const ({ | ||
required final String this.title, | ||
required final IconData this.icon, | ||
}); | ||
|
||
final String title; | ||
final IconData icon; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CupertinoPageScaffold( | ||
|
Is the
this.
prefix required; I mean isn't the preceeding type enough to disambiguate?