Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefanos Grammenos stegrams

View GitHub Profile
@stegrams
stegrams / dialog_dismiss_latency.dart
Last active Aug 15, 2020
Unable to reproduce a question's dialog freeze after user response.
View dialog_dismiss_latency.dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
@stegrams
stegrams / response_after_stateful_disposal.dart
Last active Jun 7, 2020
When setState called after await completion, usually there is not state to update. This an attempt to amend the issue.
View response_after_stateful_disposal.dart
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'dart:html';
import 'package:flutter/material.dart';
Future<String> fetchHttpRes(int id) async {
final f1 = 'first_name', f2 = 'last_name', timeoutSec = 300;
final url = 'https://reqres.in/api/users/$id?delay=$id';
@stegrams
stegrams / show_form_dialog.dart
Last active Jun 2, 2020
Show a form as custom dialog and collect the field values.
View show_form_dialog.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
@immutable
class CategoryModel {
const CategoryModel({this.name, this.keywords});
final String name;
final String keywords;
@stegrams
stegrams / calculated_textformfield.dart
Last active Jun 2, 2020
A form field that it's value is calculated based on the values of two others.
View calculated_textformfield.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@stegrams
stegrams / anim_map_location.dart
Last active May 28, 2020
Map location with an animated wave.
View anim_map_location.dart
import 'package:flutter/material.dart';
import 'dart:async';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@stegrams
stegrams / path_combine_intersect.dart
Last active May 24, 2020
Shape rendering and intersection with Path and Path.combine.
View path_combine_intersect.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@stegrams
stegrams / hack_no_uniform_border_radius.dart
Last active May 25, 2020
A small hack to apply circular radius to an uniform border.
View hack_no_uniform_border_radius.dart
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@stegrams
stegrams / variable_field_number_form.dart
Created May 17, 2020
A minimal form sample with adjustable number of fields.
View variable_field_number_form.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Form Demo',
home: MyHomePage(),
View sky_camp_layout.dart
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@stegrams
stegrams / chat_with_dotted_activity.dart
Last active May 18, 2020
Chat sample that displays a dotted balloon as editing activity indicator.
View chat_with_dotted_activity.dart
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'dart:async';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
You can’t perform that action at this time.