Skip to content

Instantly share code, notes, and snippets.

View yjbanov's full-sized avatar
💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web

Yegor yjbanov

💭
Building a Web runtime for Flutter: http://bit.ly/flutter-web
View GitHub Profile
void main() {
for (final day in List<int>.generate(365, (n) => n)) {
print('day $day, week ${day ~/ 7}, 28-day period ${day ~/ 28}');
}
}
/// The names for the values computed for each [BenchmarkMetric].
enum BenchmarkMetricComputation {
/// The name for the computed value tracking the average value of the measured
/// samples without outliers.
average,
/// The name for the computed value tracking the average of outlier samples.
outlierAverage,
/// The name for the computed value tracking the outlier average divided by
sealed class BenchmarkMetricComputation {
const BenchmarkMetricComputation(this.name);
final String name;
/// The name for the computed value tracking the average value of the measured
/// samples without outliers.
static const NamedMetricComputation average = NamedMetricComputation('average');
/// The name for the computed value tracking the average of outlier samples.
@yjbanov
yjbanov / flutter_paragraph_example.dart
Created June 26, 2024 00:10
An example of a paragraph of text
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
@pragma('dart2js:tryInline')
bool get assertionsEnabled {
var enabled = false;
assert(enabled = true);
return enabled;
}
// Elsewhere
void main() {
if (assertionsEnabled) {
@widget Counter {
final int initialValue;
@state {
int count = initialValue;
String buttonLabel = 'Increment';
}
Widget build(context) {
return Column(children: [
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp(name: 'Dash'));
}
class MyApp extends StatelessWidget {
const MyApp({super.key, required this.name});
final String name;
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp(name: 'Dash'));
}
class MyApp extends StatelessWidget {
const MyApp({super.key, required this.name});
final String name;
diff --git a/lib/web_ui/lib/src/engine/semantics/label_and_value.dart b/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
index b1e5cbbfab..8c28be3d08 100644
--- a/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
+++ b/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
@@ -242,12 +242,9 @@ final class SizedSpanRepresentation extends LabelRepresentationBehavior {
// `inline` does not support them.
..display = 'inline-block'
- // Stretch the text full width because if the text is broken up into a
- // multi-line paragraph the width of the paragraph can become smaller than
diff --git a/lib/web_ui/lib/src/engine/semantics/label_and_value.dart b/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
index 843c4dedda..f5e1bc7780 100644
--- a/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
+++ b/lib/web_ui/lib/src/engine/semantics/label_and_value.dart
@@ -27,7 +27,7 @@ enum LabelRepresentation {
/// role) JAWS on Windows. However, this role is still the most common, as it
/// applies to all container nodes, and many ARIA roles (e.g. checkboxes,
/// radios, scrollables, sliders).
- ariaLabel(AriaLabelRepresentation),
+ ariaLabel,