-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
463 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
``` | ||
tree -d -I 'node_modules|bin|build|android|ios' | pbcopy | ||
``` | ||
|
||
. | ||
├── art | ||
│ └── undraw | ||
│ └── png | ||
├── assets | ||
│ ├── audio | ||
│ │ ├── music | ||
│ │ └── sfx | ||
│ └── images | ||
│ ├── app | ||
│ ├── platform | ||
│ └── undraw | ||
├── instructions | ||
├── lib | ||
│ ├── app | ||
│ │ ├── extensions | ||
│ │ ├── models | ||
│ │ ├── modules | ||
│ │ │ ├── diary | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ ├── views | ||
│ │ │ │ │ ├── activity | ||
│ │ │ │ │ │ └── widgets | ||
│ │ │ │ │ ├── food | ||
│ │ │ │ │ │ └── scanner | ||
│ │ │ │ │ ├── water | ||
│ │ │ │ │ └── weight | ||
│ │ │ │ └── widgets | ||
│ │ │ ├── home | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ ├── intro | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ │ └── widgets | ||
│ │ │ ├── login | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ │ └── widgets | ||
│ │ │ ├── profile | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ ├── track | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ ├── update | ||
│ │ │ │ ├── bindings | ||
│ │ │ │ ├── controllers | ||
│ │ │ │ └── views | ||
│ │ │ └── zone | ||
│ │ │ ├── bindings | ||
│ │ │ ├── controllers | ||
│ │ │ └── views | ||
│ │ ├── routes | ||
│ │ ├── services | ||
│ │ │ └── persistence | ||
│ │ ├── style | ||
│ │ ├── utils | ||
│ │ └── widgets | ||
│ │ └── skinner | ||
│ │ ├── fluid_nav_bar | ||
│ │ ├── math | ||
│ │ ├── physics | ||
│ │ └── ui | ||
│ │ └── placeholder | ||
│ └── gen | ||
└── test | ||
└── helper | ||
|
||
74 directories |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
# Feature Development Guide | ||
|
||
## Initial Setup | ||
|
||
- Create feature branch: `feature/[name]` | ||
- Verify Firebase config in firebase.json | ||
- Follow existing patterns for consistency | ||
|
||
## Backend Development | ||
|
||
### Firestore Service | ||
|
||
Add new methods to firebase_service.dart following pattern: | ||
|
||
``` | ||
Future<void> saveData(String id, Map<String, dynamic> data) async { | ||
try { | ||
await _db.collection('collection').doc(id).set(data); | ||
logger.i('Data saved successfully'); | ||
} catch (e) { | ||
logger.e('Error saving data: $e'); | ||
rethrow; | ||
} | ||
} | ||
``` | ||
|
||
### Models | ||
|
||
Create models in lib/app/models/ with: | ||
|
||
- Required fields as final | ||
- Factory constructors for JSON | ||
- Clean serialization methods | ||
|
||
``` | ||
class MyModel { | ||
final String id; | ||
final String name; | ||
MyModel({required this.id, required this.name}); | ||
factory MyModel.fromJson(Map<String, dynamic> json) { | ||
return MyModel( | ||
id: json['id'] as String, | ||
name: json['name'] as String, | ||
); | ||
} | ||
Map<String, dynamic> toJson() { | ||
return { | ||
'id': id, | ||
'name': name, | ||
}; | ||
} | ||
} | ||
``` | ||
|
||
## Frontend Development | ||
|
||
### Controllers | ||
|
||
Use GetX controllers with: | ||
|
||
- Observable (.obs) variables | ||
- Clean error handling | ||
- Service injection | ||
|
||
``` | ||
class MyController extends GetxController { | ||
final service = Get.find<MyService>(); | ||
final data = <MyModel>[].obs; | ||
Future<void> loadData() async { | ||
try { | ||
data.value = await service.getData(); | ||
} catch (e) { | ||
logger.e('Error: $e'); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Views | ||
|
||
Create views with: | ||
|
||
- GetView<Controller> base class | ||
- Responsive layouts | ||
- Proper state management | ||
|
||
``` | ||
class MyView extends GetView<MyController> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: Obx(() { | ||
if (controller.data.isEmpty) { | ||
return LoadingWidget(); | ||
} else { | ||
return ListView.builder( | ||
itemCount: controller.data.length, | ||
itemBuilder: (context, index) { | ||
final item = controller.data[index]; | ||
return ListTile( | ||
title: Text(item.name), | ||
); | ||
}, | ||
); | ||
} | ||
}), | ||
), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
### UI Components | ||
|
||
Build reusable widgets: | ||
|
||
- Extract common UI patterns | ||
- Use composition over inheritance | ||
- Follow material design | ||
|
||
``` | ||
class MyWidget extends StatelessWidget { | ||
final String title; | ||
final VoidCallback onTap; | ||
Widget build(BuildContext context) { | ||
return Card( | ||
child: ListTile( | ||
title: Text(title), | ||
onTap: onTap, | ||
), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
## Testing | ||
|
||
Write tests for: | ||
|
||
- Models | ||
- Controllers | ||
- Services | ||
- Widget behavior | ||
|
||
``` | ||
test('should load data', () async { | ||
final controller = MyController(); | ||
await controller.loadData(); | ||
expect(controller.data.length, greaterThan(0)); | ||
}); | ||
``` | ||
|
||
## Key Directories | ||
|
||
- lib/app/modules/[feature]/views/ - UI components | ||
- lib/app/modules/[feature]/controllers/ - Business logic | ||
- lib/app/services/ - External services | ||
- lib/app/models/ - Data models | ||
- test/ - Test files | ||
|
||
## Build & Deploy | ||
|
||
- Use make mobile for builds | ||
- Use make test for testing | ||
- Monitor Firebase Crashlytics | ||
- Keep documentation updated |
Oops, something went wrong.