Skip to content

Commit

Permalink
Mobx examples (#109)
Browse files Browse the repository at this point in the history
* - an examples app for MobX
- updates to the website

* - an examples app for MobX
- updates to the website
- github repos

* better UI for github repos list

* renaming

* renaming in flutter_mobx and fixing the action

* more updates

* renaming stages

* more tweaks

* fixing lint in generated files, which allows you to use _XXX as the name of the abstract store class
  • Loading branch information
pavanpodila committed Feb 12, 2019
1 parent 9e9ab7c commit 0149f17
Show file tree
Hide file tree
Showing 37 changed files with 1,197 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ addons:

jobs:
include:
- stage: mobx core
- stage: MobX Core
name: mobx
env: PACKAGE=mobx
script: ./tool/run.sh
Expand All @@ -24,7 +24,7 @@ jobs:
env: PACKAGE=mobx_codegen/example
script: ./tool/run.sh

- stage: flutter related (beta)
- stage: Flutter Related (beta)
name: flutter_mobx
env: PACKAGE=flutter_mobx FLUTTER=true
before_script:
Expand All @@ -45,7 +45,7 @@ jobs:
- ./flutter/bin/flutter doctor
script: ./tool/run.sh

- stage: flutter related (master)
- stage: Flutter Related (master)
name: flutter_mobx_hooks
env: PACKAGE=flutter_mobx_hooks FLUTTER=true
before_script:
Expand Down
5 changes: 5 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,8 @@ linter:
- use_to_and_as_if_applicable
- valid_regexps
- void_checks

analyzer:
exclude:
- mobx_examples/lib/**/*.g.dart
- flutter_mobx/example/lib/**/*.g.dart
10 changes: 10 additions & 0 deletions docs/src/home.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
route: "/"
---

import publicisSapientLogo from "./images/publicis-sapient-sponsor.png";
import wunderdogLogo from "./images/wunderdog-sponsor.png";

# Mobx.dart

[MobX](https://github.com/mobxjs/mobx) for the Dart language.
Expand All @@ -14,6 +17,13 @@ route: "/"
[![Join the chat at https://gitter.im/mobxjs/mobx.dart](https://badges.gitter.im/mobxjs/mobx.dart.svg)](https://gitter.im/mobxjs/mobx.dart?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 
[![Netlify Status](https://api.netlify.com/api/v1/badges/05330d31-0411-4aac-a278-76615bcaff9e/deploy-status)](https://app.netlify.com/sites/mobx-dart/deploys) 

## Sponsors

We are very thankful to our sponsors to include us as part of their _Open Source Software (OSS)_ program.

- [<img src={publicisSapientLogo} height={64} /> **Publicis Sapient**](https://publicis.sapient.com)
- [<img src={wunderdogLogo} height={64} /> **Wunderdog**](https://wunderdog.fi)

## Introduction

MobX is a state-management library that makes it simple to connect the
Expand Down
Binary file added docs/src/images/publicis-sapient-sponsor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/images/wunderdog-sponsor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions flutter_mobx/example/lib/counter/counter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import 'package:mobx/mobx.dart';

part 'counter.g.dart';

class Counter = CounterBase with _$Counter;
class Counter = _Counter with _$Counter;

abstract class CounterBase implements Store {
abstract class _Counter implements Store {
@observable
int value = 0;

Expand Down
12 changes: 7 additions & 5 deletions flutter_mobx/example/lib/counter/counter.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions flutter_mobx/example/lib/todos/todo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import 'package:mobx/mobx.dart';

part 'todo.g.dart';

class Todo = TodoBase with _$Todo;
class Todo = _Todo with _$Todo;

abstract class TodoBase implements Store {
TodoBase(this.description);
abstract class _Todo implements Store {
_Todo(this.description);

@observable
String description = '';

@observable
bool done = false;

@action
void markDone({bool value}) => done = value;
}
20 changes: 17 additions & 3 deletions flutter_mobx/example/lib/todos/todo.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flutter_mobx/example/lib/todos/todo_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ part 'todo_list.g.dart';

enum VisibilityFilter { all, pending, completed }

class TodoList = TodoListBase with _$TodoList;
class TodoList = _TodoList with _$TodoList;

abstract class TodoListBase implements Store {
abstract class _TodoList implements Store {
@observable
ObservableList<Todo> todos = ObservableList<Todo>();

Expand Down
37 changes: 19 additions & 18 deletions flutter_mobx/example/lib/todos/todo_list.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flutter_mobx/example/lib/todos/todo_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TodoListView extends StatelessWidget {
builder: (_) => CheckboxListTile(
controlAffinity: ListTileControlAffinity.leading,
value: todo.done,
onChanged: (value) => todo.done = value,
onChanged: (value) => todo.markDone(value: value),
title: Row(
children: <Widget>[
Expanded(
Expand Down
6 changes: 3 additions & 3 deletions flutter_mobx/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
mobx: ^0.0.35
mobx:
flutter_mobx:
path: ../

dev_dependencies:
build_runner: ^1.0.0
mobx_codegen: ^0.0.5
build_runner:
mobx_codegen:
flutter_test:
sdk: flutter

Expand Down
6 changes: 3 additions & 3 deletions mobx_codegen/example/lib/src/generator_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:mobx/mobx.dart';

part 'generator_example.g.dart';

class User = UserBase with _$User;
class User = _User with _$User;

abstract class UserBase implements Store {
UserBase(this.id);
abstract class _User implements Store {
_User(this.id);

final int id;

Expand Down
16 changes: 10 additions & 6 deletions mobx_codegen/example/lib/src/generator_example.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mobx_codegen/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ dependency_overrides:
path: ../../mobx_codegen

dev_dependencies:
build_runner: ^1.1.3
build_runner: ^1.2.5
test_coverage: ^0.2.0
test: ^1.0.0
Loading

0 comments on commit 0149f17

Please sign in to comment.