feat(app): Добавить пример со Scope (#5)

* feat(app): Добавить пример со Scope

* fix scope

* feat: добавить скоуп с внутренней зависимостью от репозитория (#6)

Co-authored-by: Artem Barkalov <artembark@gmail.com>

* feat: исправить обалсть видимости ProfileScope

* feat: добавить фикс namespace плагинов

---------

Co-authored-by: PetrovY <y.petrov@friflex.com>
Co-authored-by: Artem Barkalov <artembark@gmail.com>
This commit is contained in:
Yuri Petrov
2025-02-26 13:40:43 +03:00
committed by GitHub
parent af3b941711
commit ca4cb20d58
22 changed files with 684 additions and 135 deletions

View File

@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:friflex_starter/features/profile_scope/domain/bloc/profile_scope_bloc.dart';
import 'package:friflex_starter/features/profile_scope/presentation/profile_scope.dart';
// Класс экрана, где мы инициализируем ProfileScopeBloc
class ProfileScopeScreen extends StatelessWidget {
const ProfileScopeScreen({super.key});
@override
Widget build(BuildContext context) {
return const ProfileScope(
child: _ProfileScopeView(),
);
}
}
class _ProfileScopeView extends StatelessWidget {
const _ProfileScopeView();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Profile Scope')),
body: Center(
child: BlocBuilder<ProfileScopeBloc, ProfileScopeState>(
bloc: ProfileScope.of(context).profileScopeBloc,
builder: (context, state) {
return switch (state) {
ProfileScopeSuccessState() => Text('Data: ${state.props.first}'),
ProfileScopeErrorState() => Text('Error: ${state.message}'),
_ => const CircularProgressIndicator(),
};
},
),
),
);
}
}