Skip to content

Instantly share code, notes, and snippets.

Avatar

Guilherme de Carvalho Carneiro guilhermecarvalhocarneiro

View GitHub Profile
View gist:cdd4d3f8f3bf059916f1e3e73cedbeb9
class FeedController = _FeedControllerBase with _$FeedController;
abstract class _FeedControllerBase with Store {
FeedService _service = FeedService();
@observable
ObservableList<PostModel> list;
...
}
View gist:7abb43a1769de38dfe1d5d3949920492
class CommentModel {
int id;
UsuarioModel userData;
String message;
String date;
int post;
int user;
bool rocketIt;
}
View gist:7288536f6534b8522fd377210cd2f107
class PostModel {
int id;
@observable
ObservableList<CommentModel> comments;
int commentsTotal;
List<RockItModel> rockIts;
int rockItsTotal;
List<PostPhotoModel> postPhotos;
UsuarioModel userData;
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / controller.dart
Created Apr 10, 2020
MobX para controlar a exibição ao não de um modal de processamento em flutter.
View controller.dart
abstract class _ProcessingControllerBase with Store {
// Declarando os atributos do controller
// Atributo para determinar quando está sendo processo alguma tarefa assíncrona.
@observable
bool processing = true;
// Declarando a Action para informar que o processamento iniciou
@action
beginProcessing() async => this.processing = true;
View gist:4a732fd35515190009cb8e3ededd939f
processingDialog(BuildContext context, {String message = "Processando", bool hide = false}) {
return showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
backgroundColor: Colors.black,
title: Center(
child: Text(
message,
View WidgetB
import ...
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
...
View WidgetA
import ...
class FeedPage extends StatefulWidget {
@override
_FeedPageState createState() => _FeedPageState();
}
class _FeedPageState extends State<FeedPage> {
var itemSelected = 0;
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / create.dart
Created Dec 20, 2019
Form utilizando a função de criação do Checkbox
View create.dart
children: <Widget>[
opcaoResposta(checkBoxOne, "Curso Técnico"),
opcaoResposta(checkBoxOne, "Curso Superior"),
@guilhermecarvalhocarneiro
guilhermecarvalhocarneiro / checkbox.dart
Created Dec 20, 2019
Função para ser utilizada na criação dos CheckBox no form
View checkbox.dart
Widget opcaoResposta(bool valueChecked, String label) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Checkbox(
value: valueChecked,
onChanged: (value) {
valueChecked = !valueChecked;
},
),
You can’t perform that action at this time.