Skip to content

Instantly share code, notes, and snippets.

@abhaysood
abhaysood / perfetto-config.config
Last active June 21, 2024 13:42
A perfetto config for Android
buffers: {
size_kb: 260096
fill_policy: DISCARD
}
buffers: {
size_kb: 2048
fill_policy: DISCARD
}
data_sources: {
config {
@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
@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 / 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 / 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
Last active September 29, 2021 06:37
Trigger semantics action in widget tests (medium blog)
import 'package:bug/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Tap action', (WidgetTester tester) async {
await tester.pumpWidget(MyApp());
final helloWorldTextFinder = find.text("Hello World!");
@abhaysood
abhaysood / main.dart
Last active October 4, 2021 04:56
Trigger semantics action in widget tests (medium_blog)
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
static const String label = "Hello World!";
void _showSnackbar(BuildContext context, String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
duration: const Duration(milliseconds: 1500),
@abhaysood
abhaysood / main.dart
Created September 28, 2021 16:29
Countdown Timer - Part 2
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
@abhaysood
abhaysood / main.dart
Last active September 28, 2021 16:27
Countdown Timer - Part 1
import 'dart:async';
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
@abhaysood
abhaysood / inherited_widget_issue.dart
Created June 9, 2021 09:46
inherited_widget_issue
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const DemoApp());
}
class DemoApp extends StatefulWidget {
const DemoApp({Key? key}) : super(key: key);