Skip to content

Instantly share code, notes, and snippets.

@slightfoot
slightfoot / charts.dart
Created October 10, 2018 20:10
Charts Demo - 10th October 2018 - #HumpdayQandA
import 'dart:math';
import 'package:flutter/material.dart';
void main() => runApp(ChartsDemoApp());
class ChartsDemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// MIT License
//
// Copyright (c) 2019 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / backend.dart
Last active October 3, 2019 05:46
Mock Chat App - Results of the #HumpDayQandA - Wednesday 15 August 2018
import 'model.dart';
typedef OnChatMessageCallback = void Function(int index, ChatMessage message);
abstract class ChatManager {
ChatManager();
ChatSession getNamedSession(String name);
}
@slightfoot
slightfoot / main_example.dart
Last active August 9, 2022 20:50
Paged ListView - Loads data async into the list. You'll notice if you scroll slowly you'll never see the loading spinner, this is because we specify a `cacheExtent` to the widget. `separatorBuilder` is completely optional. You can override the default loading spinner by specifying a `loadingBuilder`. Return null from the `itemLoader` to stop loa…
import 'dart:async';
import 'package:flutter/material.dart';
import 'paged_listview.dart';
void main() => runApp(MaterialApp(home: HomeScreen()));
class HomeScreen extends StatefulWidget {
@override
_HomeAppState createState() => _HomeAppState();
}