diff --git a/example/lib/l10n/app_en.arb b/example/lib/l10n/app_en.arb index b539725..2120ed1 100644 --- a/example/lib/l10n/app_en.arb +++ b/example/lib/l10n/app_en.arb @@ -3,12 +3,30 @@ "batteryPlusTitleBatteryLevel": "Battery Level", "batteryPlusDescBatteryLevel": "Battery level in percent 0 - 100", "batteryPlusTitleBatteryState": "Battery State", - "batteryPlusDescBatteryState": "Battery state: full, charging, discharging", + "batteryPlusDescBatteryState": "Battery state: full, charging, discharging, unknown", "batteryPlusTitleBatterySaveMode": "Save Mode", "batteryPlusDescBatterySaveMode": "Check is enable 'Save Mode'", "batteryPlusTitleBatteryStateLive": "Battery State 'Live'", "batteryPlusDescBatteryStateLive": "Battery change state stream", + "@_XDGA_DIRECTORIES": {}, + "xdgaDirectoriesTitleCacheLocation": "App Data Location", + "xdgaDirectoriesDescCacheLocation": "Directory location where persistent application data can be stored.", + "xdgaDirectoriesTitleAppDataLocation": "Cache Location", + "xdgaDirectoriesDescAppDataLocation": "Directory location where user-specific non-essential (cached) data should be written.", + "xdgaDirectoriesTitleDocumentsLocation": "Documents Location", + "xdgaDirectoriesDescDocumentsLocation": "Directory containing user document files.", + "xdgaDirectoriesTitleDownloadLocation": "Download Location", + "xdgaDirectoriesDescDownloadLocation": "Directory for user's downloaded files.", + "xdgaDirectoriesTitleMusicLocation": "Music Location", + "xdgaDirectoriesDescMusicLocation": "Directory containing the user's music or other audio files.", + "xdgaDirectoriesTitlePicturesLocation": "Pictures Location", + "xdgaDirectoriesDescPicturesLocation": "Directory containing the user's pictures or photos.", + "xdgaDirectoriesTitleGenericDataLocation": "Generic Data Location", + "xdgaDirectoriesDescGenericDataLocation": "Directory location where persistent data shared across applications can be stored.", + "xdgaDirectoriesTitleMoviesLocation": "Movies Location", + "xdgaDirectoriesDescMoviesLocation": "Directory containing the user's movies and videos.", + "@_COMMON": {}, "commonClose": "Close", "commonEmptyValue": "Empty", diff --git a/example/lib/l10n/app_ru.arb b/example/lib/l10n/app_ru.arb index 2a85ba0..7be503c 100644 --- a/example/lib/l10n/app_ru.arb +++ b/example/lib/l10n/app_ru.arb @@ -3,12 +3,30 @@ "batteryPlusTitleBatteryLevel": "Уровень заряда батареи", "batteryPlusDescBatteryLevel": "Уровень заряда батареи в процентах от 0 до 100", "batteryPlusTitleBatteryState": "Состояние батареи", - "batteryPlusDescBatteryState": "Состояния: full, charging, discharging", + "batteryPlusDescBatteryState": "Состояния: full, charging, discharging, unknown", "batteryPlusTitleBatterySaveMode": "Save Mode", "batteryPlusDescBatterySaveMode": "Проверка включен ли режим 'Save Mode'", "batteryPlusTitleBatteryStateLive": "Состояние батареи 'Live'", "batteryPlusDescBatteryStateLive": "Изменение состояния батареи", + "@_XDGA_DIRECTORIES": {}, + "xdgaDirectoriesTitleCacheLocation": "App Data Location", + "xdgaDirectoriesDescCacheLocation": "Расположение каталога, в котором могут храниться постоянные данные приложения.", + "xdgaDirectoriesTitleAppDataLocation": "Cache Location", + "xdgaDirectoriesDescAppDataLocation": "Расположение каталога, в котором должны быть записаны второстепенные (кэшированные) данные пользователя.", + "xdgaDirectoriesTitleDocumentsLocation": "Documents Location", + "xdgaDirectoriesDescDocumentsLocation": "Каталог, содержащий файлы документов пользователя.", + "xdgaDirectoriesTitleDownloadLocation": "Download Location", + "xdgaDirectoriesDescDownloadLocation": "Каталог для загруженных пользователем файлов.", + "xdgaDirectoriesTitleMusicLocation": "Music Location", + "xdgaDirectoriesDescMusicLocation": "Каталог, содержащий музыку пользователя или другие аудиофайлы.", + "xdgaDirectoriesTitlePicturesLocation": "Pictures Location", + "xdgaDirectoriesDescPicturesLocation": "Каталог, содержащий изображения или фотографии пользователя.", + "xdgaDirectoriesTitleGenericDataLocation": "Generic Data Location", + "xdgaDirectoriesDescGenericDataLocation": "Расположение каталога, в котором могут храниться постоянные данные, совместно используемые приложениями.", + "xdgaDirectoriesTitleMoviesLocation": "Movies Location", + "xdgaDirectoriesDescMoviesLocation": "Каталог, содержащий фильмы и видео пользователя.", + "@_COMMON": {}, "commonClose": "Закрыть", "commonEmptyValue": "Пусто", diff --git a/example/lib/packages/battery_plus/model.dart b/example/lib/packages/battery_plus/model.dart index a534e07..3c0e267 100644 --- a/example/lib/packages/battery_plus/model.dart +++ b/example/lib/packages/battery_plus/model.dart @@ -22,10 +22,10 @@ class BatteryPlusModel extends Model { Future getBatteryLevel() async { try { return await _battery.batteryLevel; - } catch (e, s) { + } catch (e) { _error = e.toString(); - debugPrintStack(stackTrace: s); } + notifyListeners(); return null; } @@ -33,10 +33,10 @@ class BatteryPlusModel extends Model { Future getBatteryState() async { try { return await _battery.batteryState; - } catch (e, s) { + } catch (e) { _error = e.toString(); - debugPrintStack(stackTrace: s); } + notifyListeners(); return null; } @@ -44,10 +44,10 @@ class BatteryPlusModel extends Model { Future isInBatterySaveMode() async { try { return await _battery.isInBatterySaveMode; - } catch (e, s) { + } catch (e) { _error = e.toString(); - debugPrintStack(stackTrace: s); } + notifyListeners(); return null; } @@ -58,9 +58,9 @@ class BatteryPlusModel extends Model { await for (final state in _battery.onBatteryStateChanged) { yield state; } - } catch (e, s) { + } catch (e) { _error = e.toString(); - debugPrintStack(stackTrace: s); + notifyListeners(); } } } \ No newline at end of file diff --git a/example/lib/packages/battery_plus/page.dart b/example/lib/packages/battery_plus/page.dart index 4bdfec1..96fa81e 100644 --- a/example/lib/packages/battery_plus/page.dart +++ b/example/lib/packages/battery_plus/page.dart @@ -28,50 +28,49 @@ class _BatteryPlusPageState extends AppState { AppLocalizations l10n, ) { return BlockLayout( - title: widget.package.key, - builder: (context, child, model) { - return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BlockInfoPackage(widget.package), - BlockAlert(model.error), - Visibility( - visible: model.error == null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - BlockItem( - title: l10n.batteryPlusTitleBatteryLevel, - desc: l10n.batteryPlusDescBatteryLevel, - future: model.getBatteryLevel(), - builder: (value) => '$value%', - ), - BlockItem( - title: l10n.batteryPlusTitleBatteryState, - desc: l10n.batteryPlusDescBatteryState, - future: model.getBatteryState(), - builder: (value) => - value.toString().split('.').last.toUpperCase(), - ), - BlockItem( - title: l10n.batteryPlusTitleBatterySaveMode, - desc: l10n.batteryPlusDescBatterySaveMode, - future: model.isInBatterySaveMode(), - ), - BlockItem( - title: l10n.batteryPlusTitleBatteryStateLive, - desc: l10n.batteryPlusDescBatteryStateLive, - stream: model.onBatteryStateChanged(), - builder: (value) => - value.toString().split('.').last.toUpperCase(), - ), - ], - ), - ) - ], - ), - ); - }); + title: widget.package.key, + builder: (context, child, model) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockInfoPackage(widget.package), + BlockAlert(model.error), + if (!model.isError) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockItem( + title: l10n.batteryPlusTitleBatteryLevel, + desc: l10n.batteryPlusDescBatteryLevel, + future: model.getBatteryLevel(), + builder: (value) => '$value%', + ), + BlockItem( + title: l10n.batteryPlusTitleBatteryState, + desc: l10n.batteryPlusDescBatteryState, + future: model.getBatteryState(), + builder: (value) => + value.toString().split('.').last.toUpperCase(), + ), + BlockItem( + title: l10n.batteryPlusTitleBatterySaveMode, + desc: l10n.batteryPlusDescBatterySaveMode, + future: model.isInBatterySaveMode(), + ), + BlockItem( + title: l10n.batteryPlusTitleBatteryStateLive, + desc: l10n.batteryPlusDescBatteryStateLive, + stream: model.onBatteryStateChanged(), + builder: (value) => + value.toString().split('.').last.toUpperCase(), + ), + ], + ), + ], + ), + ); + }, + ); } } diff --git a/example/lib/packages/xdga_directories/model.dart b/example/lib/packages/xdga_directories/model.dart index ea659fc..e1aa80a 100644 --- a/example/lib/packages/xdga_directories/model.dart +++ b/example/lib/packages/xdga_directories/model.dart @@ -1,8 +1,107 @@ import 'package:flutter/widgets.dart'; import 'package:scoped_model/scoped_model.dart'; +import 'package:xdga_directories/xdga_directories.dart' as xdga; /// Model for [XdgaDirectoriesPage] class XdgaDirectoriesModel extends Model { /// Get [ScopedModel] - static XdgaDirectoriesModel of(BuildContext context) => ScopedModel.of(context); -} \ No newline at end of file + static XdgaDirectoriesModel of(BuildContext context) => + ScopedModel.of(context); + + /// Error + String? _error; + + /// Public error + String? get error => _error; + + /// Public error + bool get isError => _error != null; + + /// QStandardPaths::CacheLocation + String? getCacheLocation() { + try { + return xdga.getCacheLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::AppDataLocation + String? getAppDataLocation() { + try { + return xdga.getAppDataLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::DocumentsLocation + String? getDocumentsLocation() { + try { + return xdga.getDocumentsLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::DownloadLocation + String? getDownloadLocation() { + try { + return xdga.getDownloadLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::MusicLocation + String? getMusicLocation() { + try { + return xdga.getMusicLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::PicturesLocation + String? getPicturesLocation() { + try { + return xdga.getPicturesLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::GenericDataLocation + String? getGenericDataLocation() { + try { + return xdga.getGenericDataLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } + + /// QStandardPaths::MoviesLocation + String? getMoviesLocation() { + try { + return xdga.getMoviesLocation(); + } catch (e) { + _error = e.toString(); + } + notifyListeners(); + return null; + } +} diff --git a/example/lib/packages/xdga_directories/page.dart b/example/lib/packages/xdga_directories/page.dart index 39b7f95..24e6f45 100644 --- a/example/lib/packages/xdga_directories/page.dart +++ b/example/lib/packages/xdga_directories/page.dart @@ -3,6 +3,9 @@ import 'package:flutter_example_packages/base/package/package.dart'; import 'package:flutter_example_packages/packages/xdga_directories/model.dart'; import 'package:flutter_example_packages/packages/xdga_directories/package.dart'; import 'package:flutter_example_packages/widgets/base/export.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_alert.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_info_package.dart'; +import 'package:flutter_example_packages/widgets/blocks/block_item.dart'; import 'package:flutter_example_packages/widgets/layouts/block_layout.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -25,9 +28,64 @@ class _XdgaDirectoriesPageState extends AppState { AppLocalizations l10n, ) { return BlockLayout( - title: widget.package.key, - builder: (context, child, model) { - return Text(widget.package.desc); - }); + title: widget.package.key, + builder: (context, child, model) { + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockInfoPackage(widget.package), + BlockAlert(model.error), + if (!model.isError) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BlockItem( + title: l10n.xdgaDirectoriesTitleCacheLocation, + desc: l10n.xdgaDirectoriesDescCacheLocation, + value: model.getCacheLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleAppDataLocation, + desc: l10n.xdgaDirectoriesDescAppDataLocation, + value: model.getAppDataLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleDocumentsLocation, + desc: l10n.xdgaDirectoriesDescDocumentsLocation, + value: model.getDocumentsLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleDownloadLocation, + desc: l10n.xdgaDirectoriesDescDownloadLocation, + value: model.getDownloadLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleMusicLocation, + desc: l10n.xdgaDirectoriesDescMusicLocation, + value: model.getMusicLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitlePicturesLocation, + desc: l10n.xdgaDirectoriesDescPicturesLocation, + value: model.getPicturesLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleGenericDataLocation, + desc: l10n.xdgaDirectoriesDescGenericDataLocation, + value: model.getGenericDataLocation(), + ), + BlockItem( + title: l10n.xdgaDirectoriesTitleMoviesLocation, + desc: l10n.xdgaDirectoriesDescMoviesLocation, + value: model.getMoviesLocation(), + ), + ], + ), + ], + ), + ); + }, + ); } } diff --git a/example/lib/pages/home/widgets/package_list_item.dart b/example/lib/pages/home/widgets/package_list_item.dart index 2d7a60e..43331ca 100644 --- a/example/lib/pages/home/widgets/package_list_item.dart +++ b/example/lib/pages/home/widgets/package_list_item.dart @@ -25,117 +25,131 @@ class PackageListItemWidget extends AppStatelessWidget { MediaQueryData media, AppLocalizations l10n, ) { - return Container( - decoration: BoxDecoration( - color: Colors.blueGrey, - borderRadius: index == 0 - ? const BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ) - : null, - ), - child: Padding( - padding: index == 0 - ? const EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 0) - : const EdgeInsets.symmetric(horizontal: 20), - child: Column( - children: [ - Stack( + return Stack( + children: [ + Visibility( + visible: index != 0, + child: Container( + height: 10, + width: double.infinity, + transform: Matrix4.translationValues(0.0, -10, 0.0), + color: Colors.blueGrey, + ), + ), + Container( + decoration: BoxDecoration( + color: Colors.blueGrey, + borderRadius: index == 0 + ? const BorderRadius.only( + topLeft: Radius.circular(20), + topRight: Radius.circular(20), + ) + : null, + ), + child: Padding( + padding: index == 0 + ? const EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 0) + : const EdgeInsets.symmetric(horizontal: 20), + child: Column( children: [ - Padding( - padding: const EdgeInsets.only(top: 10), - child: Stack( - children: [ - SizedBox( - width: double.infinity, - child: Card( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.all(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextTitleSmall(item.key), - const SizedBox(height: 10), - TextBodyMedium( - item.desc, - color: Colors.black.withOpacity(0.6), - ), - const SizedBox(height: 12), - Divider( - height: 1, - color: AppColors.primary.withOpacity(0.2), + Stack( + children: [ + Padding( + padding: const EdgeInsets.only(top: 10), + child: Stack( + children: [ + SizedBox( + width: double.infinity, + child: Card( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextTitleSmall(item.key), + const SizedBox(height: 10), + TextBodyMedium( + item.desc, + color: Colors.black.withOpacity(0.6), + ), + const SizedBox(height: 12), + Divider( + height: 1, + color: AppColors.primary.withOpacity(0.2), + ), + const SizedBox(height: 12), + TextBodySmall( + l10n.homeListVersion(item.version), + color: AppColors.primary.withOpacity(0.7), + ), + ], ), - const SizedBox(height: 12), - TextBodySmall( - l10n.homeListVersion(item.version), - color: AppColors.primary.withOpacity(0.7), - ), - ], + ), ), ), - ), - ), - Positioned.fill( - child: Material( - color: Colors.transparent, - child: InkWell( - customBorder: RoundedRectangleBorder( - borderRadius: AppRadius.small, + Positioned.fill( + child: Material( + color: Colors.transparent, + child: InkWell( + customBorder: RoundedRectangleBorder( + borderRadius: AppRadius.small, + ), + hoverColor: Colors.transparent, + onTap: () { + if (item is PackagePage) { + Navigator.pushNamed( + context, '/${item.key}'); + } else if (item is PackageDialog) { + showDialog( + context: context, + builder: (BuildContext context) { + return PackageInfoDialog( + package: item as PackageDialog, + ); + }); + } + }, + ), ), - hoverColor: Colors.transparent, - onTap: () { - if (item is PackagePage) { - Navigator.pushNamed(context, '/${item.key}'); - } else if (item is PackageDialog) { - showDialog( - context: context, - builder: (BuildContext context) { - return PackageInfoDialog( - package: item as PackageDialog, - ); - }); - } - }, ), - ), + ], ), - ], - ), - ), - Align( - alignment: FractionalOffset.topRight, - child: Container( - margin: const EdgeInsets.only(right: 16), - decoration: BoxDecoration( - color: item.isPlatformDependent - ? Colors.deepOrangeAccent - : Colors.blueAccent, - borderRadius: AppRadius.small, ), - child: Padding( - padding: const EdgeInsets.only( - left: 6, - top: 3, - right: 6, - bottom: 6, - ), - child: TextBodySmall( - item.isPlatformDependent - ? l10n.homeListStateDependent - : l10n.homeListStateIndependent, - color: Colors.white, + Align( + alignment: FractionalOffset.topRight, + child: Container( + margin: const EdgeInsets.only(right: 16), + decoration: BoxDecoration( + color: item.isPlatformDependent + ? Colors.deepOrangeAccent + : Colors.blueAccent, + borderRadius: AppRadius.small, + ), + child: Padding( + padding: const EdgeInsets.only( + left: 6, + top: 3, + right: 6, + bottom: 6, + ), + child: TextBodySmall( + item.isPlatformDependent + ? l10n.homeListStateDependent + : l10n.homeListStateIndependent, + color: Colors.white, + ), + ), ), ), - ), + ], ), + const SizedBox(height: 20), ], ), - const SizedBox(height: 20), - ], + ), ), - ), + ], ); } } diff --git a/example/lib/theme/theme.dart b/example/lib/theme/theme.dart index 35f0541..c4659d5 100644 --- a/example/lib/theme/theme.dart +++ b/example/lib/theme/theme.dart @@ -70,7 +70,7 @@ final appTheme = ThemeData( height: 1.3, ), bodyMedium: GoogleFonts.openSans( - fontSize: 14, + fontSize: 16, height: 1.3, ), bodySmall: GoogleFonts.openSans( diff --git a/example/lib/widgets/blocks/block_item.dart b/example/lib/widgets/blocks/block_item.dart index 42ff987..6a20fb1 100644 --- a/example/lib/widgets/blocks/block_item.dart +++ b/example/lib/widgets/blocks/block_item.dart @@ -9,6 +9,7 @@ class BlockItem extends AppStatelessWidget { super.key, required this.title, required this.desc, + this.value, this.future, this.stream, this.builder, @@ -16,26 +17,26 @@ class BlockItem extends AppStatelessWidget { final String title; final String desc; + final T? value; final Stream? stream; final Future? future; final Function(T)? builder; - AsyncWidgetBuilder get widgetBuilder => - (BuildContext context, AsyncSnapshot snapshot) { + AsyncWidgetBuilder get widgetBuilder => + (BuildContext context, AsyncSnapshot snapshot) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ TextTitleSmall(title), const SizedBox(height: 8), - TextBodySmall(desc), + TextBodyMedium(desc), const SizedBox(height: 8), if (snapshot.hasData) TextBodyMedium( - snapshot.data == null - ? '-' - : (builder == null - ? snapshot.data.toString() - : builder?.call(snapshot.data as T)), + builder == null + ? snapshot.data.toString() + : builder?.call(snapshot.data as T), + fontWeight: FontWeight.bold, ), if (!snapshot.hasData) const SizedBox( @@ -64,11 +65,14 @@ class BlockItem extends AppStatelessWidget { ); } if (future != null) { - return FutureBuilder( + return FutureBuilder( future: future, builder: widgetBuilder, ); } - throw "Please enter a value stream or future"; + return FutureBuilder( + future: Future.value(value), + builder: widgetBuilder, + ); } } diff --git a/example/lib/widgets/layouts/block_layout.dart b/example/lib/widgets/layouts/block_layout.dart index 1b459bf..e0a5f76 100644 --- a/example/lib/widgets/layouts/block_layout.dart +++ b/example/lib/widgets/layouts/block_layout.dart @@ -24,38 +24,40 @@ class BlockLayout extends AppStatelessWidget { ) { return ScopedModel( model: getIt(), - child: ScopedModelDescendant(builder: (context, child, model) { - return Scaffold( - appBar: title == null - ? null - : AppBar( - leading: Padding( - padding: const EdgeInsets.all(8.0), - child: ClipOval( - child: Material( - color: Colors.blueGrey, - child: IconButton( - icon: const Icon(Icons.arrow_back), - tooltip: 'Back', - onPressed: () { - Navigator.of(context).pop(); - }, + child: ScopedModelDescendant( + builder: (context, child, model) { + return Scaffold( + appBar: title == null + ? null + : AppBar( + leading: Padding( + padding: const EdgeInsets.all(8.0), + child: ClipOval( + child: Material( + color: Colors.blueGrey, + child: IconButton( + icon: const Icon(Icons.arrow_back), + tooltip: 'Back', + onPressed: () { + Navigator.of(context).pop(); + }, + ), ), ), ), + backgroundColor: AppColors.primary, + title: TextTitleSmall( + title!, + color: Colors.white, + ), ), - backgroundColor: AppColors.primary, - title: TextTitleSmall( - title!, - color: Colors.white, - ), - ), - body: Padding( - padding: EdgeInsets.all(title == null ? 0 : 20), - child: builder.call(context, child, model), - ), - ); - }), + body: Padding( + padding: EdgeInsets.all(title == null ? 0 : 20), + child: builder.call(context, child, model), + ), + ); + }, + ), ); } } diff --git a/example/lib/widgets/texts/text_base.dart b/example/lib/widgets/texts/text_base.dart index 76caf65..295f0b3 100644 --- a/example/lib/widgets/texts/text_base.dart +++ b/example/lib/widgets/texts/text_base.dart @@ -6,11 +6,13 @@ class TextBase extends StatelessWidget { super.key, this.color, this.textAlign, + this.fontWeight, }); final String data; final Color? color; final TextAlign? textAlign; + final FontWeight? fontWeight; TextStyle? getStyle(BuildContext context) { return Theme.of(context).textTheme.bodyMedium; @@ -20,7 +22,9 @@ class TextBase extends StatelessWidget { Widget build(BuildContext context) { return Text( data, - style: getStyle(context)?.copyWith(color: color ?? Colors.black), + style: getStyle(context)?.copyWith(color: color ?? Colors.black).copyWith( + fontWeight: fontWeight, + ), textAlign: textAlign, ); } diff --git a/example/lib/widgets/texts/text_body_large.dart b/example/lib/widgets/texts/text_body_large.dart index 33f2abb..3158758 100644 --- a/example/lib/widgets/texts/text_body_large.dart +++ b/example/lib/widgets/texts/text_body_large.dart @@ -6,6 +6,7 @@ class TextBodyLarge extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_body_medium.dart b/example/lib/widgets/texts/text_body_medium.dart index bffef81..1cd5b40 100644 --- a/example/lib/widgets/texts/text_body_medium.dart +++ b/example/lib/widgets/texts/text_body_medium.dart @@ -6,6 +6,7 @@ class TextBodyMedium extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_body_small.dart b/example/lib/widgets/texts/text_body_small.dart index c6db243..519d25d 100644 --- a/example/lib/widgets/texts/text_body_small.dart +++ b/example/lib/widgets/texts/text_body_small.dart @@ -6,6 +6,7 @@ class TextBodySmall extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_headline_large.dart b/example/lib/widgets/texts/text_headline_large.dart index f8b4935..4f0ed15 100644 --- a/example/lib/widgets/texts/text_headline_large.dart +++ b/example/lib/widgets/texts/text_headline_large.dart @@ -6,6 +6,7 @@ class TextHeadlineLarge extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_headline_medium.dart b/example/lib/widgets/texts/text_headline_medium.dart index 25aa2d8..e61958c 100644 --- a/example/lib/widgets/texts/text_headline_medium.dart +++ b/example/lib/widgets/texts/text_headline_medium.dart @@ -6,6 +6,7 @@ class TextHeadlineMedium extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_headline_small.dart b/example/lib/widgets/texts/text_headline_small.dart index bc5a8bd..5583403 100644 --- a/example/lib/widgets/texts/text_headline_small.dart +++ b/example/lib/widgets/texts/text_headline_small.dart @@ -6,6 +6,7 @@ class TextHeadlineSmall extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_title_large.dart b/example/lib/widgets/texts/text_title_large.dart index c719464..d5f9641 100644 --- a/example/lib/widgets/texts/text_title_large.dart +++ b/example/lib/widgets/texts/text_title_large.dart @@ -6,6 +6,7 @@ class TextTitleLarge extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_title_medium.dart b/example/lib/widgets/texts/text_title_medium.dart index 3ad7f5b..9a34024 100644 --- a/example/lib/widgets/texts/text_title_medium.dart +++ b/example/lib/widgets/texts/text_title_medium.dart @@ -6,6 +6,7 @@ class TextTitleMedium extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/lib/widgets/texts/text_title_small.dart b/example/lib/widgets/texts/text_title_small.dart index 19316fb..5ece6ca 100644 --- a/example/lib/widgets/texts/text_title_small.dart +++ b/example/lib/widgets/texts/text_title_small.dart @@ -6,6 +6,7 @@ class TextTitleSmall extends TextBase { super.key, super.color, super.textAlign, + super.fontWeight, }); @override diff --git a/example/pubspec.lock b/example/pubspec.lock index e20b59e..83e13ef 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -607,6 +607,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + xdga_directories: + dependency: "direct main" + description: + path: "../packages/xdga_directories" + relative: true + source: path + version: "0.0.1" xml: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f0c1483..c27e7a3 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -26,9 +26,9 @@ dependencies: ## https://pub.dev/packages/universal_io universal_io: ^2.2.0 -# ## https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/master/packages/xdga_directories -# xdga_directories: -# path: ../packages/xdga_directories + ## https://os-git.omprussia.ru/non-oss/flutter/flutter-plugins/-/tree/master/packages/xdga_directories + xdga_directories: + path: ../packages/xdga_directories ## https://pub.dev/packages/battery_plus battery_plus: ^4.0.1