Skip to content

Instantly share code, notes, and snippets.

View Morthor's full-sized avatar
👋
https://morthor.medium.com/

João Soares Morthor

👋
https://morthor.medium.com/
View GitHub Profile
@Morthor
Morthor / enums_with_members.dart
Last active May 20, 2022 10:11
Demonstrating the use of Enums with Members as available from Dart 2.17
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@Morthor
Morthor / main.dart
Created May 1, 2021 19:21
Example on how to do a vertical slide transition with the new view pushing up the previous view.
Navigator.of(context).push(PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => ItemView(), // This is the view you are navigating to
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return Stack(
children: <Widget>[
SlideTransition(
position: Tween<Offset>(
begin: Offset.zero,
end: Offset(0, -1),
).animate(animation),
@Morthor
Morthor / main.dart
Created January 27, 2021 16:38
Selectable list with long press on list item
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@Morthor
Morthor / main.dart
Created January 13, 2021 23:00
Todo App for DartPad
import 'package:flutter/material.dart';
void main() => runApp(Main());
class Main extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'FlutterTodo',
home: Home(),
@Morthor
Morthor / main.dart
Last active December 30, 2020 15:20
AnimatedList, SizeTransition & Dismissible
// Created for use in this Medium article: https://morthor.medium.com/flutter-animatedlist-sizetransition-dismissible-dce49c11200d
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
@Morthor
Morthor / main.dart
Last active December 30, 2020 12:01
Medium article on SharedPreferences
// Created for use in this Medium article: https://morthor.medium.com/flutter-data-persistence-with-sharedpreferences-e11d3f77ecf7
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
runApp(MyApp());
}
@Morthor
Morthor / main.dart
Last active July 27, 2020 10:26
CheckBox Issue 63112014
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
body: CheckBox63112014(),
),
),
);
@Morthor
Morthor / expansion_tile_issue.dart
Created March 6, 2020 13:25
ExpansionTile Issue
class FirstPageExpansionTileIssue extends StatefulWidget {
@override
_FirstPageExpansionTileIssueState createState() => _FirstPageExpansionTileIssueState();
}
class _FirstPageExpansionTileIssueState extends State<FirstPageExpansionTileIssue> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
@Morthor
Morthor / main.dart
Created January 8, 2020 13:53
CircleAvatar
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@Morthor
Morthor / main.dart
Created December 23, 2019 16:27
AnimateTo end of ListView
import 'package:flutter/material.dart';
Future<void> main() async {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(