Skip to content

Instantly share code, notes, and snippets.

View edemekong's full-sized avatar
🏠
Working from home

Paul Jeremiah edemekong

🏠
Working from home
View GitHub Profile
extension on WidgetTester {
Future<void> launchApp() async {
await app.main();
await pumpAndSettle();
}
Future<void> clearState() async {
await SharedPreferences.getInstance().then((it) => it.clear());
}
@edemekong
edemekong / chat_message_render_box.dart
Created September 22, 2023 17:54 — forked from craiglabenz/chat_message_render_box.dart
Demonstrates a custom RenderObject that draws chat messages like WhatsApp, where the `sentAt` timestamp is tucked into the last line if it fits
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Showcasing Flutter',
home: HomePage(),
import 'package:flutter/material.dart';
import 'alert_dialog.dart';
Future<bool?> showAlertDialogs(BuildContext context, {required String title, required String content}) async {
bool? response;
await showDialog(
context: context,
builder: (context) => MyAlertDialog(
title: title,
content: content,
import 'package:flutter/material.dart';
import 'package:showcasing_flutter/components/show_dialog.dart';
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
@edemekong
edemekong / alert_dialog.dart
Last active January 4, 2022 15:11
Track Dialog Flutter
import 'package:flutter/material.dart';
class MyAlertDialog extends StatelessWidget {
final String title;
final String content;
final String buttonText1;
final String? buttonText2;
final void Function(bool v) callback;
const MyAlertDialog(