Commit 603347cf authored by Brian Egan's avatar Brian Egan

The Great Rename

parent d4e187cf
# flutter_mvc
# flutter_architecture_samples
A library for Dart developers. It is awesome.
......@@ -6,7 +6,7 @@ A library for Dart developers. It is awesome.
A simple usage example:
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
main() {
var awesome = new Awesome();
......
......@@ -4,13 +4,13 @@ We have created this short spec to help you create awesome and consistent todo a
## Reference Application
The [vanilla](https://gitlab.com/brianegan/flutter_mvc/example/vanilla/) implementation should be used as the reference app and as a base when implementing a new todo app. Before implementing your own, we recommend that you interact with some of the other apps to see how they're built and how they behave. If something is unclear or could be improved, [let us know](https://gitlab.com/brianegan/flutter_mvc/issues).
The [vanilla](https://gitlab.com/brianegan/flutter_architecture_samples/example/vanilla/) implementation should be used as the reference app and as a base when implementing a new todo app. Before implementing your own, we recommend that you interact with some of the other apps to see how they're built and how they behave. If something is unclear or could be improved, [let us know](https://gitlab.com/brianegan/flutter_architecture_samples/issues).
Your app should look and behave exactly like the template and the other examples.
### README
All examples must include a README describing the framework, the general implementation, and the build process if required. Please check the [vanilla](https://gitlab.com/brianegan/flutter_mvc/example/vanilla/) implementation for an example.
All examples must include a README describing the framework, the general implementation, and the build process if required. Please check the [vanilla](https://gitlab.com/brianegan/flutter_architecture_samples/example/vanilla/) implementation for an example.
### Code
......
......@@ -25,7 +25,7 @@ Let's start with a Simple Example. Say our app had only 1 Tab: The `List of Todo
Now, we add a sibling Widget: The `Stats Tab`! But wait, it needs access to the List of Todos so it can calculate how many of them are active and how many are complete. So how do we share that data?
It can be difficult for siblings to pass their state to each other. For example, say both Widges were displayed side-by-side at the same time: How would Flutter know when to re-build the `Stats Tab` to reflect the latest count when the List of Todos changes?
It can be difficult for siblings to pass their state to each other. For example, say both Widgets were displayed side-by-side at the same time: How would Flutter know when to re-build the `Stats Tab` to reflect the latest count when the List of Todos changes?
```
+-------------+ +-------------+
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/data/todos_service.dart';
import 'package:vanilla/models.dart';
import 'package:vanilla/screens/add_edit_screen.dart';
......@@ -40,13 +40,13 @@ class VanillaAppState extends State<VanillaApp> {
Widget build(BuildContext context) {
return new MaterialApp(
title: new VanillaLocalizations().appTitle,
theme: FlutterMvcTheme.theme,
theme: ArchSampleTheme.theme,
localizationsDelegates: [
new ArchitectureLocalizationsDelegate(),
new ArchSampleLocalizationsDelegate(),
new VanillaLocalizationsDelegate(),
],
routes: {
FlutterMvcRoutes.home: (context) {
ArchSampleRoutes.home: (context) {
return new TabsScreen(
appState: appState,
updateTodo: updateTodo,
......@@ -56,7 +56,7 @@ class VanillaAppState extends State<VanillaApp> {
clearCompleted: clearCompleted,
);
},
FlutterMvcRoutes.addTodo: (context) {
ArchSampleRoutes.addTodo: (context) {
return new AddEditScreen(
addTodo: addTodo,
updateTodo: updateTodo,
......
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
class AppState {
bool isLoading;
......
......@@ -2,7 +2,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
import 'package:vanilla/widgets/typedefs.dart';
......@@ -23,15 +23,15 @@ class AddEditScreen extends StatelessWidget {
@required this.updateTodo,
this.todo,
})
: super(key: key ?? FlutterMvcKeys.addTodoScreen);
: super(key: key ?? ArchSampleKeys.addTodoScreen);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(isEditing
? ArchitectureLocalizations.of(context).editTodo
: ArchitectureLocalizations.of(context).addTodo),
? ArchSampleLocalizations.of(context).editTodo
: ArchSampleLocalizations.of(context).addTodo),
),
body: new Padding(
padding: new EdgeInsets.all(16.0),
......@@ -50,9 +50,9 @@ class AddEditScreen extends StatelessWidget {
style: Theme.of(context).textTheme.headline,
decoration: new InputDecoration(
hintText:
ArchitectureLocalizations.of(context).newTodoHint),
ArchSampleLocalizations.of(context).newTodoHint),
validator: (val) => val.trim().isEmpty
? ArchitectureLocalizations.of(context).emptyTodoError
? ArchSampleLocalizations.of(context).emptyTodoError
: null,
),
new TextFormField(
......@@ -61,7 +61,7 @@ class AddEditScreen extends StatelessWidget {
maxLines: 10,
style: Theme.of(context).textTheme.subhead,
decoration: new InputDecoration(
hintText: ArchitectureLocalizations.of(context).notesHint,
hintText: ArchSampleLocalizations.of(context).notesHint,
),
)
],
......@@ -70,8 +70,8 @@ class AddEditScreen extends StatelessWidget {
),
floatingActionButton: new FloatingActionButton(
tooltip: isEditing
? ArchitectureLocalizations.of(context).saveChanges
: ArchitectureLocalizations.of(context).addTodo,
? ArchSampleLocalizations.of(context).saveChanges
: ArchSampleLocalizations.of(context).addTodo,
child: new Icon(isEditing ? Icons.check : Icons.add),
onPressed: () {
final form = formKey.currentState;
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
import 'package:vanilla/screens/add_edit_screen.dart';
import 'package:vanilla/widgets/typedefs.dart';
......@@ -24,10 +24,10 @@ class DetailScreen extends StatelessWidget {
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(ArchitectureLocalizations.of(context).todoDetails),
title: new Text(ArchSampleLocalizations.of(context).todoDetails),
actions: [
new IconButton(
tooltip: ArchitectureLocalizations.of(context).deleteTodo,
tooltip: ArchSampleLocalizations.of(context).deleteTodo,
icon: new Icon(Icons.delete),
onPressed: () {
onDelete();
......@@ -78,7 +78,7 @@ class DetailScreen extends StatelessWidget {
),
),
floatingActionButton: new FloatingActionButton(
tooltip: ArchitectureLocalizations.of(context).editTodo,
tooltip: ArchSampleLocalizations.of(context).editTodo,
child: new Icon(Icons.edit),
onPressed: () {
Navigator.of(context).push(
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
import 'package:vanilla/localization.dart';
import 'package:vanilla/widgets/extra_actions_button.dart';
......@@ -87,15 +87,15 @@ class TabsScreenState extends State<TabsScreen> {
numCompleted: widget.appState.numCompleted,
),
floatingActionButton: new FloatingActionButton(
key: FlutterMvcKeys.addTodoFab,
key: ArchSampleKeys.addTodoFab,
onPressed: () {
Navigator.pushNamed(context, FlutterMvcRoutes.addTodo);
Navigator.pushNamed(context, ArchSampleRoutes.addTodo);
},
child: new Icon(Icons.add),
tooltip: ArchitectureLocalizations.of(context).addTodo,
tooltip: ArchSampleLocalizations.of(context).addTodo,
),
bottomNavigationBar: new BottomNavigationBar(
key: FlutterMvcKeys.tabs,
key: ArchSampleKeys.tabs,
currentIndex: AppTab.values.indexOf(activeTab),
onTap: (index) {
_updateTab(AppTab.values[index]);
......@@ -104,8 +104,8 @@ class TabsScreenState extends State<TabsScreen> {
return new BottomNavigationBarItem(
icon: new Icon(tab == AppTab.todos ? Icons.list : Icons.show_chart),
title: new Text(tab == AppTab.stats
? ArchitectureLocalizations.of(context).stats
: ArchitectureLocalizations.of(context).todos),
? ArchSampleLocalizations.of(context).stats
: ArchSampleLocalizations.of(context).todos),
);
}).toList(),
),
......
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
class ExtraActionsButton extends StatelessWidget {
......@@ -23,13 +23,13 @@ class ExtraActionsButton extends StatelessWidget {
new PopupMenuItem<ExtraAction>(
value: ExtraAction.toggleAllComplete,
child: new Text(allComplete
? ArchitectureLocalizations.of(context).markAllIncomplete
: ArchitectureLocalizations.of(context).markAllComplete),
? ArchSampleLocalizations.of(context).markAllIncomplete
: ArchSampleLocalizations.of(context).markAllComplete),
),
new PopupMenuItem<ExtraAction>(
value: ExtraAction.clearCompleted,
child: new Text(
ArchitectureLocalizations.of(context).clearCompleted),
ArchSampleLocalizations.of(context).clearCompleted),
),
],
);
......
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
class FilterButton extends StatelessWidget {
......@@ -23,14 +23,14 @@ class FilterButton extends StatelessWidget {
opacity: isActive ? 1.0 : 0.0,
duration: new Duration(milliseconds: 150),
child: new PopupMenuButton<VisibilityFilter>(
tooltip: ArchitectureLocalizations.of(context).filterTodos,
tooltip: ArchSampleLocalizations.of(context).filterTodos,
onSelected: onSelected,
itemBuilder: (BuildContext context) =>
<PopupMenuItem<VisibilityFilter>>[
new PopupMenuItem<VisibilityFilter>(
value: VisibilityFilter.all,
child: new Text(
ArchitectureLocalizations.of(context).showAll,
ArchSampleLocalizations.of(context).showAll,
style: activeFilter == VisibilityFilter.all
? activeStyle
: defaultStyle,
......@@ -39,7 +39,7 @@ class FilterButton extends StatelessWidget {
new PopupMenuItem<VisibilityFilter>(
value: VisibilityFilter.active,
child: new Text(
ArchitectureLocalizations.of(context).showActive,
ArchSampleLocalizations.of(context).showActive,
style: activeFilter == VisibilityFilter.active
? activeStyle
: defaultStyle,
......@@ -48,7 +48,7 @@ class FilterButton extends StatelessWidget {
new PopupMenuItem<VisibilityFilter>(
value: VisibilityFilter.completed,
child: new Text(
ArchitectureLocalizations.of(context).showCompleted,
ArchSampleLocalizations.of(context).showCompleted,
style: activeFilter == VisibilityFilter.completed
? activeStyle
: defaultStyle,
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
class StatsCounter extends StatelessWidget {
final int numActive;
......@@ -18,7 +18,7 @@ class StatsCounter extends StatelessWidget {
new Padding(
padding: new EdgeInsets.only(bottom: 8.0),
child: new Text(
ArchitectureLocalizations
ArchSampleLocalizations
.of(context)
.completedTodos,
style: Theme
......@@ -40,7 +40,7 @@ class StatsCounter extends StatelessWidget {
new Padding(
padding: new EdgeInsets.only(bottom: 8.0),
child: new Text(
ArchitectureLocalizations
ArchSampleLocalizations
.of(context)
.activeTodos,
style: Theme
......
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mvc/flutter_mvc.dart';
import 'package:flutter_architecture_samples/flutter_architecture_samples.dart';
import 'package:vanilla/models.dart';
import 'package:vanilla/screens/detail_screen.dart';
import 'package:vanilla/widgets/todo_item.dart';
......@@ -27,10 +27,10 @@ class TodoList extends StatelessWidget {
child: loading
? new Center(
child: new CircularProgressIndicator(
key: FlutterMvcKeys.loading,
key: ArchSampleKeys.loading,
))
: new ListView.builder(
key: FlutterMvcKeys.todoList,
key: ArchSampleKeys.todoList,
itemCount: filteredTodos.length,
itemBuilder: (BuildContext context, int index) {
final todo = filteredTodos[index];
......@@ -71,12 +71,12 @@ class TodoList extends StatelessWidget {
duration: new Duration(seconds: 2),
backgroundColor: Theme.of(context).backgroundColor,
content: new Text(
ArchitectureLocalizations.of(context).todoDeleted(todo.task),
ArchSampleLocalizations.of(context).todoDeleted(todo.task),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
action: new SnackBarAction(
label: ArchitectureLocalizations.of(context).undo,
label: ArchSampleLocalizations.of(context).undo,
onPressed: () {
addTodo(todo);
},
......
......@@ -4,7 +4,7 @@ description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
flutter_mvc:
flutter_architecture_samples:
path: ../../
dev_dependencies:
......
......@@ -4,10 +4,12 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/dribbble_auth/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/dribbble_auth/build" />
<excludeFolder url="file://$MODULE_DIR$/example/vanilla/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/vanilla/build" />
<excludeFolder url="file://$MODULE_DIR$/../flutter_mvc/build" />
<excludeFolder url="file://$MODULE_DIR$/../flutter_mvc/example/dribbble_auth/.pub" />
<excludeFolder url="file://$MODULE_DIR$/../flutter_mvc/example/dribbble_auth/build" />
<excludeFolder url="file://$MODULE_DIR$/../flutter_mvc/example/vanilla/.pub" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
......
/// The core logic and presentation code that each app should feel free to use
/// as a base for .
library flutter_mvc;
library flutter_architecture_samples;
export 'src/keys.dart';
export 'src/uuid.dart';
......
import 'package:flutter/widgets.dart';
class FlutterMvcKeys {
class ArchSampleKeys {
static final loading = new UniqueKey();
static final input = new UniqueKey();
static final clearCompleted = new UniqueKey();
......
......@@ -2,22 +2,22 @@ import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart';
import 'package:flutter_mvc/src/localizations/messages_all.dart';
import 'package:flutter_architecture_samples/src/localizations/messages_all.dart';
class ArchitectureLocalizations {
ArchitectureLocalizations(this.locale);
class ArchSampleLocalizations {
ArchSampleLocalizations(this.locale);
final Locale locale;
static Future<ArchitectureLocalizations> load(Locale locale) {
static Future<ArchSampleLocalizations> load(Locale locale) {
return initializeMessages(locale.toString()).then((Null value) {
return new ArchitectureLocalizations(locale);
return new ArchSampleLocalizations(locale);
});
}
static ArchitectureLocalizations of(BuildContext context) {
return Localizations.of<ArchitectureLocalizations>(
context, ArchitectureLocalizations);
static ArchSampleLocalizations of(BuildContext context) {
return Localizations.of<ArchSampleLocalizations>(
context, ArchSampleLocalizations);
}
String get todos => Intl.message(
......@@ -156,7 +156,7 @@ class ArchitectureLocalizations {
String todoDeleted(String task) => Intl.message(
'Deleted "$task"',
name: 'todoDeleted',
args: [],
args: [task],
locale: locale.toString(),
);
......@@ -189,12 +189,12 @@ class ArchitectureLocalizations {
);
}
class ArchitectureLocalizationsDelegate
extends LocalizationsDelegate<ArchitectureLocalizations> {
class ArchSampleLocalizationsDelegate
extends LocalizationsDelegate<ArchSampleLocalizations> {
@override
Future<ArchitectureLocalizations> load(Locale locale) =>
ArchitectureLocalizations.load(locale);
Future<ArchSampleLocalizations> load(Locale locale) =>
ArchSampleLocalizations.load(locale);
@override
bool shouldReload(ArchitectureLocalizationsDelegate old) => false;
bool shouldReload(ArchSampleLocalizationsDelegate old) => false;
}
......@@ -13,6 +13,8 @@ final _keepAnalysisHappy = Intl.defaultLocale;
class MessageLookup extends MessageLookupByLibrary {
get localeName => 'en';
static m0(task) => "Deleted \"${task}\"";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => {
"activeTodos" : MessageLookupByLibrary.simpleMessage("Active Todos"),
......@@ -35,6 +37,7 @@ class MessageLookup extends MessageLookupByLibrary {
"showAll" : MessageLookupByLibrary.simpleMessage("Show All"),
"showCompleted" : MessageLookupByLibrary.simpleMessage("Show Completed"),
"stats" : MessageLookupByLibrary.simpleMessage("Stats"),
"todoDeleted" : m0,
"todoDetails" : MessageLookupByLibrary.simpleMessage("Todo Details"),
"todos" : MessageLookupByLibrary.simpleMessage("Todos"),
"undo" : MessageLookupByLibrary.simpleMessage("Undo")
......
class FlutterMvcRoutes {
class ArchSampleRoutes {
static final home = "/";
static final addTodo = "/addTodo";
}
import 'package:flutter/material.dart';
class FlutterMvcTheme {
class ArchSampleTheme {
static final theme = new ThemeData.dark().copyWith(
primaryColor: Colors.grey[800],
accentColor: Colors.cyan[300],
......
name: flutter_mvc
name: flutter_architecture_samples
description: A starting point for Dart libraries or applications.
version: 0.0.1
#homepage: https://www.example.com
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment