Skip to content

Instantly share code, notes, and snippets.

View pedromassango's full-sized avatar

Pedro Massango pedromassango

View GitHub Profile
@pedromassango
pedromassango / manipulate_list_and_tuple.py
Last active August 19, 2021 21:32
# Manipulating Lists and Tuples
def add_layer(triangle):
# Add a layer to Pascal's triangle.
# Each layer should be a tuple.
last = triangle[-1]
newTuple = []
for i in range(len(last)):
newTuple.append(last[i] + last[i-1])
newTuple.append(1)
triangle.append(tuple(newTuple))
pass
@pedromassango
pedromassango / emu_crash.log
Last active July 12, 2021 16:12
EMU crash logs on Apple M1
cannot add library /Users/pedromassango/fuchsia/prebuilt/third_party/aemu/mac-x64/emulator-darwin-aarch64-0.2/qemu/darwin-aarch64/lib64/vulkan/libvulkan.dylib: failed
cannot add library /Users/pedromassango/fuchsia/prebuilt/third_party/aemu/mac-x64/emulator-darwin-aarch64-0.2/lib64/vulkan/libvulkan.dylib: failed
cannot add library /Users/pedromassango/fuchsia/prebuilt/third_party/aemu/mac-x64/emulator-darwin-aarch64-0.2/qemu/darwin-aarch64/lib64/vulkan/libMoltenVK.dylib: failed
added library /Users/pedromassango/fuchsia/prebuilt/third_party/aemu/mac-x64/emulator-darwin-aarch64-0.2/lib64/vulkan/libMoltenVK.dylib
[mvk-info] MoltenVK version 1.1.1. Vulkan version 1.1.154.
The following 70 Vulkan extensions are supported:
VK_KHR_16bit_storage v1
VK_KHR_8bit_storage v1
VK_KHR_bind_memory2 v1
/// The main screen launched with Navigator.push(...)
/// the question is where do I load the data of the EmailPage, without making it a StatefulWidget?
/// I guess we can solve that by adding a callback on the BlocBuilder widget.
class RegistrationFlow extends StatelessWidget {
const RegistrationFlow({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
testWidgets('Ellipsis is passed to the inner TextPainter when provided', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Material(
child: SelectableText(
'overflow',
maxLines: 1,
style: TextStyle(overflow: TextOverflow.ellipsis),
),
),
@pedromassango
pedromassango / explicit_return.dart
Created April 4, 2021 19:50
Lint rule: explicit_return for nullable types
// Copyright (c) 2021, 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 'dart:async';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@pedromassango
pedromassango / state_restoration_example.dart
Last active December 15, 2020 14:37
Exemplo de Restauração de Estado no Flutter
import 'package:flutter/material.dart';
void main() => runApp(
RootRestorationScope(
restorationId: 'root_id',
child: App(),
),
);
class App extends StatelessWidget {
@pedromassango
pedromassango / bottom_nav_bar.dart
Created November 24, 2020 15:33
Navigaton Bar without state restoration
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
@pedromassango
pedromassango / scaffold_messenger_app.dart
Created November 18, 2020 19:58
ScaffoldMessenger Example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
@pedromassango
pedromassango / text_selection_test.dart
Created October 9, 2020 23:27
Text selection issue
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
final _controller = TextEditingController(text: 'Please select me!');
@override
import 'package:flutter/material.dart';
void main() {
//final GlobalKey<FormState> _formState = GlobalKey();
final GlobalKey<FormFieldState> _formFieldState = GlobalKey();
runApp(MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
visualDensity: VisualDensity.adaptivePlatformDensity,