Add missing parameter to TableBorder.symmetric, and improve class constructors (#144279)

Originally, my aim was just to refactor (as per usual), but while messing around with the `TableBorder.symmetric` constructor, I realized that `borderRadius` was missing!

This pull request makes a few class constructors more efficient, and it fixes #144277 by adding the missing parameter.

<br>
This commit is contained in:
Nate
2024-03-04 13:20:19 -07:00
committed by GitHub
parent 1d7f4a9afa
commit 1a0dc8f1e1
36 changed files with 195 additions and 356 deletions

View File

@@ -76,7 +76,7 @@ ${parser.usage}
final FrameworkRepository framework = FrameworkRepository(
_localCheckouts(token),
mirrorRemote: Remote.mirror(mirrorUrl),
mirrorRemote: const Remote.mirror(mirrorUrl),
upstreamRemote: Remote.upstream(upstreamUrl),
);

View File

@@ -23,25 +23,11 @@ enum RemoteName {
}
class Remote {
const Remote({
required RemoteName name,
required this.url,
}) : _name = name,
assert(url != '');
const Remote({required RemoteName name, required this.url})
: _name = name, assert(url != '');
factory Remote.mirror(String url) {
return Remote(
name: RemoteName.mirror,
url: url,
);
}
factory Remote.upstream(String url) {
return Remote(
name: RemoteName.upstream,
url: url,
);
}
const Remote.mirror(String url) : this(name: RemoteName.mirror, url: url);
const Remote.upstream(String url) : this(name: RemoteName.upstream, url: url);
final RemoteName _name;

View File

@@ -422,18 +422,6 @@ Duration _computeAverageDuration(List<BlinkTraceEvent> events) {
/// See also:
/// * https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
class BlinkTraceEvent {
BlinkTraceEvent._({
required this.args,
required this.cat,
required this.name,
required this.ph,
this.pid,
this.tid,
this.ts,
this.tts,
this.tdur,
});
/// Parses an event from its JSON representation.
///
/// Sample event encoded as JSON (the data is bogus, this just shows the format):
@@ -458,19 +446,16 @@ class BlinkTraceEvent {
/// For detailed documentation of the format see:
///
/// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
static BlinkTraceEvent fromJson(Map<String, dynamic> json) {
return BlinkTraceEvent._(
args: json['args'] as Map<String, dynamic>,
cat: json['cat'] as String,
name: json['name'] as String,
ph: json['ph'] as String,
pid: _readInt(json, 'pid'),
tid: _readInt(json, 'tid'),
ts: _readInt(json, 'ts'),
tts: _readInt(json, 'tts'),
tdur: _readInt(json, 'tdur'),
);
}
BlinkTraceEvent.fromJson(Map<String, dynamic> json)
: args = json['args'] as Map<String, dynamic>,
cat = json['cat'] as String,
name = json['name'] as String,
ph = json['ph'] as String,
pid = _readInt(json, 'pid'),
tid = _readInt(json, 'tid'),
ts = _readInt(json, 'ts'),
tts = _readInt(json, 'tts'),
tdur = _readInt(json, 'tdur');
/// Event-specific data.
final Map<String, dynamic> args;

View File

@@ -22,8 +22,6 @@ import 'constants.dart';
///
/// * [AccessibilityNodeInfo](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo)
class AndroidSemanticsNode {
AndroidSemanticsNode._(this._values);
/// Deserializes a new [AndroidSemanticsNode] from a json map.
///
/// The structure of the JSON:
@@ -54,9 +52,7 @@ class AndroidSemanticsNode {
/// int,
/// ]
/// }
factory AndroidSemanticsNode.deserialize(String value) {
return AndroidSemanticsNode._(json.decode(value));
}
AndroidSemanticsNode.deserialize(String value) : _values = json.decode(value);
final dynamic _values;
final List<AndroidSemanticsNode> _children = <AndroidSemanticsNode>[];

View File

@@ -183,8 +183,8 @@ class FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
@override
Widget build(BuildContext context) {
final SyntaxHighlighterStyle style = Theme.of(context).brightness == Brightness.dark
? SyntaxHighlighterStyle.darkThemeStyle()
: SyntaxHighlighterStyle.lightThemeStyle();
? SyntaxHighlighterStyle.darkThemeStyle
: SyntaxHighlighterStyle.lightThemeStyle;
Widget body;
if (_exampleCode == null) {

View File

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:string_scanner/string_scanner.dart';
class SyntaxHighlighterStyle {
SyntaxHighlighterStyle({
const SyntaxHighlighterStyle({
this.baseStyle,
this.numberStyle,
this.commentStyle,
@@ -17,31 +17,27 @@ class SyntaxHighlighterStyle {
this.constantStyle,
});
static SyntaxHighlighterStyle lightThemeStyle() {
return SyntaxHighlighterStyle(
baseStyle: const TextStyle(color: Color(0xFF000000)),
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
keywordStyle: const TextStyle(color: Color(0xFF9C27B0)),
stringStyle: const TextStyle(color: Color(0xFF43A047)),
punctuationStyle: const TextStyle(color: Color(0xFF000000)),
classStyle: const TextStyle(color: Color(0xFF512DA8)),
constantStyle: const TextStyle(color: Color(0xFF795548)),
);
}
static const SyntaxHighlighterStyle lightThemeStyle = SyntaxHighlighterStyle(
baseStyle: TextStyle(color: Color(0xFF000000)),
numberStyle: TextStyle(color: Color(0xFF1565C0)),
commentStyle: TextStyle(color: Color(0xFF9E9E9E)),
keywordStyle: TextStyle(color: Color(0xFF9C27B0)),
stringStyle: TextStyle(color: Color(0xFF43A047)),
punctuationStyle: TextStyle(color: Color(0xFF000000)),
classStyle: TextStyle(color: Color(0xFF512DA8)),
constantStyle: TextStyle(color: Color(0xFF795548)),
);
static SyntaxHighlighterStyle darkThemeStyle() {
return SyntaxHighlighterStyle(
baseStyle: const TextStyle(color: Color(0xFFFFFFFF)),
numberStyle: const TextStyle(color: Color(0xFF1565C0)),
commentStyle: const TextStyle(color: Color(0xFF9E9E9E)),
keywordStyle: const TextStyle(color: Color(0xFF80CBC4)),
stringStyle: const TextStyle(color: Color(0xFF009688)),
punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)),
classStyle: const TextStyle(color: Color(0xFF009688)),
constantStyle: const TextStyle(color: Color(0xFF795548)),
);
}
static const SyntaxHighlighterStyle darkThemeStyle = SyntaxHighlighterStyle(
baseStyle: TextStyle(color: Color(0xFFFFFFFF)),
numberStyle: TextStyle(color: Color(0xFF1565C0)),
commentStyle: TextStyle(color: Color(0xFF9E9E9E)),
keywordStyle: TextStyle(color: Color(0xFF80CBC4)),
stringStyle: TextStyle(color: Color(0xFF009688)),
punctuationStyle: TextStyle(color: Color(0xFFFFFFFF)),
classStyle: TextStyle(color: Color(0xFF009688)),
constantStyle: TextStyle(color: Color(0xFF795548)),
);
final TextStyle? baseStyle;
final TextStyle? numberStyle;
@@ -60,7 +56,7 @@ abstract class SyntaxHighlighter {
class DartSyntaxHighlighter extends SyntaxHighlighter {
DartSyntaxHighlighter([this._style]) {
_spans = <_HighlightSpan>[];
_style ??= SyntaxHighlighterStyle.darkThemeStyle();
_style ??= SyntaxHighlighterStyle.darkThemeStyle;
}
SyntaxHighlighterStyle? _style;

View File

@@ -9,9 +9,7 @@ class TypographyTemplate extends TokenTemplate {
@override
String generate() => '''
class _M3Typography {
_M3Typography._();
abstract final class _M3Typography {
${_textTheme('englishLike', 'alphabetic')}
${_textTheme('dense', 'ideographic')}