File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed
packages/cosmos_ui_components/lib Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'package:cosmos_utils/app_info_provider.dart' ;
2+ import 'package:flutter/foundation.dart' ;
3+ import 'package:flutter/material.dart' ;
4+
5+ class AppVersionText extends StatelessWidget {
6+ const AppVersionText ({
7+ required this .appInfoProvider,
8+ this .style,
9+ Key ? key,
10+ }) : super (key: key);
11+ final AppInfoProvider appInfoProvider;
12+ final TextStyle ? style;
13+
14+ @override
15+ Widget build (BuildContext context) => FutureBuilder <String >(
16+ future: appInfoProvider.getAppVersion (),
17+ builder: (context, snapshot) => Text (
18+ snapshot.data ?? '' ,
19+ style: style,
20+ ),
21+ );
22+
23+ @override
24+ void debugFillProperties (DiagnosticPropertiesBuilder properties) {
25+ super .debugFillProperties (properties);
26+ properties
27+ ..add (DiagnosticsProperty <AppInfoProvider >('appInfoProvider' , appInfoProvider))
28+ ..add (DiagnosticsProperty <TextStyle ?>('style' , style));
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ import 'package:cosmos_ui_components/cosmos_ui_components.dart' ;
2+ import 'package:flutter/foundation.dart' ;
3+ import 'package:flutter/material.dart' ;
4+
5+ class ChipText extends StatelessWidget {
6+ const ChipText ({
7+ required this .title,
8+ this .style,
9+ this .backgroundColor,
10+ Key ? key,
11+ }) : super (key: key);
12+ final String title;
13+ final TextStyle ? style;
14+ final Color ? backgroundColor;
15+
16+ @override
17+ Widget build (BuildContext context) {
18+ final theme = CosmosTheme .of (context);
19+ return Container (
20+ padding: EdgeInsets .all (theme.spacingM),
21+ decoration: BoxDecoration (
22+ borderRadius: BorderRadius .circular (10 ),
23+ color: backgroundColor ?? theme.colors.chipBackground,
24+ ),
25+ child: Text (
26+ title,
27+ style: style,
28+ ),
29+ );
30+ }
31+
32+ @override
33+ void debugFillProperties (DiagnosticPropertiesBuilder properties) {
34+ super .debugFillProperties (properties);
35+ properties
36+ ..add (StringProperty ('title' , title))
37+ ..add (DiagnosticsProperty <TextStyle ?>('style' , style))
38+ ..add (ColorProperty ('backgroundColor' , backgroundColor));
39+ }
40+ }
Original file line number Diff line number Diff line change 11library cosmos_ui_components;
22
3+ export 'components/app_version_text.dart' ;
4+ export 'components/chip_text.dart' ;
35export 'components/content_loading_indicator.dart' ;
46export 'components/content_state_switcher.dart' ;
57export 'components/cosmos_app_bar.dart' ;
You can’t perform that action at this time.
0 commit comments