Skip to content

Instantly share code, notes, and snippets.

@abhaysood
abhaysood / main.dart
Last active October 4, 2021 02:34
Testing a semantic announcement in Flutter
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
child: Text("announce"),
@abhaysood
abhaysood / main.dart
Created October 4, 2021 02:57
semantic_announcement_tester sample tests
testWidgets('One announcement', (WidgetTester tester) async {
final mock = MockSemanticAnnouncements(tester);
const expectedAnnouncement = AnnounceSemanticsEvent(
"Announcement made",
TextDirection.ltr,
);
await tester.pumpWidget(const MyApp());
// Tap to trigger an announcement
await tester.tap(find.byType(ElevatedButton));
expect(
@abhaysood
abhaysood / draggable_scrollable_sheet.dart
Created February 11, 2022 06:11
Draggable scrollable sheet with static content on bottom
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
@abhaysood
abhaysood / inner_shadow_custom_paint.dart
Created March 7, 2022 07:17
Drawing a inner shadow using custom paint along a path
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override