refactor(ui): Update some UI and fix some bugs
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sfm_app/product/base/bloc/base_bloc.dart';
|
||||
import '../product/base/bloc/base_bloc.dart';
|
||||
import '../product/services/api_services.dart';
|
||||
import '../feature/bell/bell_model.dart';
|
||||
import '../feature/settings/profile/profile_model.dart';
|
||||
|
||||
class MainBloc extends BlocBase {
|
||||
APIServices apiServices = APIServices();
|
||||
final bellBloc = StreamController<Bell>.broadcast();
|
||||
StreamSink<Bell> get sinkBellBloc => bellBloc.sink;
|
||||
Stream<Bell> get streamBellBloc => bellBloc.stream;
|
||||
|
||||
|
||||
final language = StreamController<Locale?>.broadcast();
|
||||
StreamSink<Locale?> get sinkLanguage => language.sink;
|
||||
Stream<Locale?> get streamLanguage => language.stream;
|
||||
|
||||
|
||||
final theme = StreamController<ThemeData?>.broadcast();
|
||||
StreamSink<ThemeData?> get sinkTheme => theme.sink;
|
||||
Stream<ThemeData?> get streamTheme => theme.stream;
|
||||
@@ -26,6 +29,16 @@ class MainBloc extends BlocBase {
|
||||
StreamSink<bool> get sinkIsVNIcon => isVNIcon.sink;
|
||||
Stream<bool> get streamIsVNIcon => isVNIcon.stream;
|
||||
|
||||
final userProfile = StreamController<User>.broadcast();
|
||||
StreamSink<User> get sinkUserProfile => userProfile.sink;
|
||||
Stream<User> get streamUserProfile => userProfile.stream;
|
||||
|
||||
@override
|
||||
void dispose() {}
|
||||
|
||||
void getUserProfile() async {
|
||||
String data = await apiServices.getUserDetail();
|
||||
User user = User.fromJson(jsonDecode(data));
|
||||
sinkUserProfile.add(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user