26 lines
832 B
Dart
26 lines
832 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||
|
import 'package:gps/blocs/bloc_provider.dart';
|
||
|
import 'package:gps/blocs/gps_bloc.dart';
|
||
|
|
||
|
class GpsTitleWidgetBloc extends StatelessWidget {
|
||
|
const GpsTitleWidgetBloc({
|
||
|
Key? key,
|
||
|
}) : super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
final GpsBloc bloc = BlocProvider.of<GpsBloc>(context);
|
||
|
|
||
|
return StreamBuilder(
|
||
|
stream: bloc.stateOut,
|
||
|
initialData: GpsBlocState.notRecording,
|
||
|
builder: (BuildContext context, AsyncSnapshot<GpsBlocState> snapshot) {
|
||
|
String title = AppLocalizations.of(context)!.appName;
|
||
|
final state =
|
||
|
(snapshot.data == GpsBlocState.recording) ? "- recording" : "";
|
||
|
return Text("$title $state");
|
||
|
});
|
||
|
}
|
||
|
}
|