Skip to content

Instantly share code, notes, and snippets.

View Norbert515's full-sized avatar
😃

Norbert Kozsir Norbert515

😃
View GitHub Profile
@Norbert515
Norbert515 / login1.dart
Created July 26, 2018 07:57
columns inside columns
child: Column(
children: <Widget>[
Flexible(
flex: 4,
child: new Column(
children: <Widget>[
// Your children ..
],
),
),
@Norbert515
Norbert515 / scaffold.dart
Created July 21, 2018 07:40
scaffold edge inserts
// The minimum insets for contents of the Scaffold to keep visible.
final EdgeInsets minInsets = mediaQuery.padding.copyWith(
bottom: widget.resizeToAvoidBottomPadding ? mediaQuery.viewInsets.bottom : 0.0,
);
@Norbert515
Norbert515 / implicitly_animated_count.dart
Created July 17, 2018 13:20
implicitly animated count example
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
class Repository {
static final Repository _repo = new Repository._internal();
BookDatabase database;
static Repository get() {
return _repo;
}
@Norbert515
Norbert515 / utils.dart
Created February 24, 2018 10:31
fade route
class FadeRoute<T> extends MaterialPageRoute<T> {
FadeRoute({ WidgetBuilder builder, RouteSettings settings })
: super(builder: builder, settings: settings);
@override
Widget buildTransitions(BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
if (settings.isInitialRoute)
@Norbert515
Norbert515 / main.dart
Created February 24, 2018 10:29
navigation
onTap: (){
Navigator.of(context).push(
new FadeRoute(
builder: (BuildContext context) => new BookNotesPage(bookState),
settings: new RouteSettings(name: '/notes', isInitialRoute: false),
));
},
@Norbert515
Norbert515 / main.dart
Created February 24, 2018 10:29
hero
new Hero(
child: new Image.network(bookState.url),
tag: bookState.id,
):
@Norbert515
Norbert515 / error
Created February 21, 2018 11:58
error
I/flutter ( 5025): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter ( 5025): The following assertion was thrown while handling a gesture:
I/flutter ( 5025): 'package:flutter/src/material/page.dart': Failed assertion: line 84 pos 12: 'opaque': is not true.
I/flutter ( 5025):
I/flutter ( 5025): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 5025): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 5025): In either case, please report this assertion by filing a bug on GitHub:
I/flutter ( 5025): https://github.com/flutter/flutter/issues/new
I/flutter ( 5025):
I/flutter ( 5025): When the exception was thrown, this was the stack:
@Norbert515
Norbert515 / book_notes_page.dart
Created February 20, 2018 19:15
BookNotesPage#initState()
@override
void initState() {
super.initState();
_textController = new TextEditingController(text: widget.book.notes);
subject.stream.debounce(new Duration(milliseconds: 400)).listen((text){
widget.book.notes = text;
BookDatabase.get().updateBook(widget.book);
});
}
@Norbert515
Norbert515 / main.dart
Created February 20, 2018 19:12
BookCard-IconButton
child: new IconButton(
icon: bookState.starred? new Icon(Icons.star): new Icon(Icons.star_border),
color: Colors.black,
onPressed: (){
setState(() {
bookState.starred = !bookState.starred;
});
BookDatabase.get().updateBook(bookState);
},
),