This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# analysis_options.yaml | |
analyzer: | |
exclude: | |
- lib/generated/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform, NativeModules } from 'react-native' | |
import I18n from 'i18n-js' | |
import en from './en-US' // importa o objeto de traduções para o idioma inglês | |
import pt from './pt-BR' // importa o objeto de traduções para o idioma português | |
// Função que irá nos auxiliar a normalizar as traduções que serão recebidas pela função getLanguageByDevice | |
// Isso é necessário pois no android e no iOS o retorno do mesmo idioma pode ser diferente | |
// Exemplo: no iOS podemos receber pt_US e no android pt_BR para o idioma português Brasil. | |
const normalizeTranslate = { | |
'en_US': 'en_US', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
interface Props { | |
initialState: number, | |
step: number | |
} | |
function useCounter({ initialState, step }: Props) { | |
const [count, setCount] = useState(initialState) | |
const increment = () => setCount(count + step) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:example/src/widgets/button.dart'; | |
import 'package:example/src/widgets/button.doc_widget.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:doc_widget/doc_widget.dart'; | |
void main() { | |
final button = ElementPreview( | |
document: ButtonDocWidget(), // From generated file | |
previews: [ | |
WidgetPreview( // This will show your widget and a description about. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Counter { | |
Counter({this.count}); | |
int count; | |
void increment() { | |
count++; | |
} | |
void decrement() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
flutter: | |
sdk: flutter | |
another_package: | |
path: ../another_package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:widget_test/heart.dart'; | |
// Função auxiliar para envolver os widgets a serem testados. | |
Widget makeTestable(Widget widget) => MaterialApp(home: widget); | |
void main() { | |
testWidgets('Heart smoke test', (WidgetTester tester) async { | |
// pumpWidget() renderiza a UI dado um widget. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
void main() => runApp(TopWidget()); | |
class CounterInherited extends InheritedWidget { | |
CounterInherited({ | |
Key key, | |
@required this.state, | |
@required Widget child, | |
}) : super(key: key, child: child); |
NewerOlder