chore: 初始化脚手架 — sunny_mochi 企业级 Flutter 模板

Core 基础设施:Flavor 三包体系、Drift+SQLCipher 加密数据库
7 拦截器 Dio 网络栈、CrashReporter 崩溃日志、Sealed Failure 错误体系
5 色板主题系统、Auth 认证骨架(Clean Architecture)、Dev Panel、Mock Adapter

通过验证:flutter analyze(0 errors)、flutter test(全绿)、staging APK 74.8MB
This commit is contained in:
SkyJourney
2026-05-14 12:51:05 +08:00
commit 61017f1c39
204 changed files with 15386 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import 'package:drift/drift.dart';
import 'package:sunny_mochi/core/storage/app_database.dart';
import 'package:sunny_mochi/core/storage/tables/users_table.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'users_dao.g.dart';
@DriftAccessor(tables: [Users])
class UsersDao extends DatabaseAccessor<AppDatabase> with _$UsersDaoMixin {
UsersDao(super.attachedDatabase);
Future<UserRow?> getById(String userId) =>
(select(users)..where((u) => u.userId.equals(userId))).getSingleOrNull();
Stream<UserRow?> watchById(String userId) => (select(
users,
)..where((u) => u.userId.equals(userId))).watchSingleOrNull();
Future<void> upsert(UsersCompanion user) =>
into(users).insertOnConflictUpdate(user);
Future<int> deleteById(String userId) =>
(delete(users)..where((u) => u.userId.equals(userId))).go();
}
@Riverpod(keepAlive: true)
UsersDao usersDao(Ref ref) => UsersDao(ref.watch(appDatabaseProvider));
+64
View File
@@ -0,0 +1,64 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'users_dao.dart';
// ignore_for_file: type=lint
mixin _$UsersDaoMixin on DatabaseAccessor<AppDatabase> {
$UsersTable get users => attachedDatabase.users;
UsersDaoManager get managers => UsersDaoManager(this);
}
class UsersDaoManager {
final _$UsersDaoMixin _db;
UsersDaoManager(this._db);
$$UsersTableTableManager get users =>
$$UsersTableTableManager(_db.attachedDatabase, _db.users);
}
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(usersDao)
final usersDaoProvider = UsersDaoProvider._();
final class UsersDaoProvider
extends $FunctionalProvider<UsersDao, UsersDao, UsersDao>
with $Provider<UsersDao> {
UsersDaoProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'usersDaoProvider',
isAutoDispose: false,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$usersDaoHash();
@$internal
@override
$ProviderElement<UsersDao> $createElement($ProviderPointer pointer) =>
$ProviderElement(pointer);
@override
UsersDao create(Ref ref) {
return usersDao(ref);
}
/// {@macro riverpod.override_with_value}
Override overrideWithValue(UsersDao value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<UsersDao>(value),
);
}
}
String _$usersDaoHash() => r'209c5286cb20f72750a77a007a5c04c7ef22bfea';