Skip to content

Instantly share code, notes, and snippets.

View talamaska's full-sized avatar

Zlati Pehlivanov talamaska

View GitHub Profile
@talamaska
talamaska / bottom_sheet.dart
Created August 2, 2021 19:46 — forked from andrelsmoraes/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss) - Flutter Version: Channel beta, v0.5.1
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@talamaska
talamaska / bottom_sheet.dart
Created August 2, 2021 18:26 — forked from slightfoot/bottom_sheet.dart
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss)
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@talamaska
talamaska / adaptive_scaffold.dart
Created July 7, 2021 20:28 — forked from rodydavis/adaptive_scaffold.dart
Flutter Adaptive Scaffold
import 'package:flutter/material.dart';
const kTabletBreakpoint = 720.0;
const kDesktopBreakpoint = 1200.0;
const kSideMenuWidth = 250.0;
class AdaptiveScaffold extends StatelessWidget {
final List<TabItem> tabs;
final int selectedIndex;
final ValueChanged<int> onSelectionChanged;
@talamaska
talamaska / dart_inheritance.dart
Created April 26, 2021 20:18
Function arguments are contravariant (whereas generics are covariant)
/// quick question about Something<T extends SomethingElse>
class Bar {}
class Baz extends Bar {}
typedef Foo<T extends Bar> = void Function(T);
void printBaz(Baz baz) => print(baz);
final list = <Foo>[];
@talamaska
talamaska / dart.yml
Created March 12, 2021 12:09 — forked from lukepighetti/dart.yml
Flutter Web + GitHub Actions + Firebase Hosting Preview Channels
# .github/workflows/dart.yml
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
@talamaska
talamaska / main.dart
Created February 1, 2021 22:11 — forked from av/main.dart
Flutter: texture generator playground
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
void main() async => runApp(MaterialApp(home: Root()));
/// Waits till [ui.Image] is generated and renders
/// it using [CustomPaint] to render it. Allows use of [MediaQuery]
class Root extends StatelessWidget {
@talamaska
talamaska / text_gradient.dart
Last active November 24, 2020 16:08
text with gradient
final colors = [
Color(0xffff0000), Color(0xffffff00), Color(0xff00ff00),
Color(0xff00ffff), Color(0xff0000ff), Color(0xffff00ff), Color(0xffff0000),
];
final colorStops = [0 / 6, 1 / 6, 2 / 6, 3 / 6, 4 / 6, 5 / 6, 6 / 6];
final gradient = new ui.Gradient.linear(
Offset(0.0, 0.0),
Offset(0.0, size.height),
colors,
colorStops,
@talamaska
talamaska / Flutter Vikings Logo Contest
Created November 18, 2020 14:05
Flutter Vikings Logo Contest
// 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';
import 'dart:ui' as ui;
void main() => runApp(FlutterVikingsLogoApp());
class FlutterVikingsLogoApp extends StatelessWidget {
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class Destination {
const Destination(this.index, this.title, this.icon, this.color);
final int index;
final String title;
final IconData icon;
final MaterialColor color;
}
@talamaska
talamaska / gist:f537d2fcfcab249efc2dd3893d310a97
Created November 11, 2020 15:35 — forked from wshaddix/gist:8797934
Gets the week number for a given date
main () {
// get today's date
var now = new DateTime.now();
// set it to feb 10th for testing
//now = now.add(new Duration(days:7));
int today = now.weekday;