From a4b6085055a485b0f03ec6a1be29bac4fb513aa3 Mon Sep 17 00:00:00 2001 From: Nico Vidoni <30844036+smallTrogdor@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:18:31 +0200 Subject: [PATCH] feat: add standard deprecation hints for all web components (#142) --- CHANGELOG.md | 10 ++++++ lib/src/breadcrumb/sbb_breadcrumb.dart | 4 +++ lib/src/logo/sbb_logo.dart | 1 + .../notification/sbb_web_notification.dart | 22 +++++++----- lib/src/status/sbb_status.dart | 2 +- lib/src/theme/sbb_typography.dart | 36 ++++++++++--------- 6 files changed, 49 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80030899..db192056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ It is expected that you keep this format strictly, since we depend on it in our ## [Unreleased] +### Deprecated + +- (#142) Deprecated Web Components: + - `SBBStatus` + - `SBBWebLogo` + - `SBBLeanTextStyles` + - `SBBWebText` + - `SBBWebTextStyles` + - `SBBBreadcrumb` + ## [1.4.0] - 2024-06-07 ### Added diff --git a/lib/src/breadcrumb/sbb_breadcrumb.dart b/lib/src/breadcrumb/sbb_breadcrumb.dart index 08db4bd0..e876463e 100644 --- a/lib/src/breadcrumb/sbb_breadcrumb.dart +++ b/lib/src/breadcrumb/sbb_breadcrumb.dart @@ -6,7 +6,9 @@ import '../../design_system_flutter.dart'; /// https://digital.sbb.ch/de/webapps/components/breadcrumb /// /// +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBBreadcrumb extends StatelessWidget { + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBBreadcrumb({ Key? key, this.leading, @@ -112,7 +114,9 @@ class _InheritedBreadcrumbStyle extends InheritedWidget { } } +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBBreadcrumbItem extends StatefulWidget { + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBBreadcrumbItem({ Key? key, required this.child, diff --git a/lib/src/logo/sbb_logo.dart b/lib/src/logo/sbb_logo.dart index dc47d4a4..1bd8b360 100644 --- a/lib/src/logo/sbb_logo.dart +++ b/lib/src/logo/sbb_logo.dart @@ -93,6 +93,7 @@ class SBBLogo extends StatelessWidget { /// creates SBB Logo /// /// respects parent's size and scales accordingly +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBWebLogo extends StatelessWidget { const SBBWebLogo({ Key? key, diff --git a/lib/src/notification/sbb_web_notification.dart b/lib/src/notification/sbb_web_notification.dart index 05fe18eb..f4c55333 100644 --- a/lib/src/notification/sbb_web_notification.dart +++ b/lib/src/notification/sbb_web_notification.dart @@ -7,7 +7,9 @@ const _kVerticalPadding = 12.0; const _kHorizontalPadding = 16.0; const _kScrollingDuration = Duration(milliseconds: 600); +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBWebNotification extends StatefulWidget { + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebNotification.confirmation( this.text, { Key? key, @@ -18,7 +20,7 @@ class SBBWebNotification extends StatefulWidget { this.jumpMarks, this.expand = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebNotification.hint( this.text, { Key? key, @@ -29,7 +31,7 @@ class SBBWebNotification extends StatefulWidget { this.jumpMarks, this.expand = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebNotification.warning( this.text, { Key? key, @@ -40,7 +42,7 @@ class SBBWebNotification extends StatefulWidget { this.jumpMarks, this.expand = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebNotification.error( this.text, { Key? key, @@ -123,6 +125,13 @@ class _SBBWebNotificationState extends State axisAlignment: 1.0, sizeFactor: animation, child: Container( + decoration: BoxDecoration( + color: widget.backgroundColor, + borderRadius: + const BorderRadius.all(Radius.circular(_kBorderRadius)), + border: widget.borderColor != null + ? Border.all(color: widget.borderColor!) + : null), child: Padding( padding: const EdgeInsets.symmetric( horizontal: _kHorizontalPadding, vertical: _kVerticalPadding), @@ -165,17 +174,12 @@ class _SBBWebNotificationState extends State ], ), ), - decoration: BoxDecoration( - color: widget.backgroundColor, - borderRadius: BorderRadius.all(Radius.circular(_kBorderRadius)), - border: widget.borderColor != null - ? Border.all(color: widget.borderColor!) - : null), ), ); } } +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBJumpMark extends StatelessWidget { const SBBJumpMark({Key? key, required this.text, required this.keyToScrollTo}) : super(key: key); diff --git a/lib/src/status/sbb_status.dart b/lib/src/status/sbb_status.dart index 66645e4a..190f27ba 100644 --- a/lib/src/status/sbb_status.dart +++ b/lib/src/status/sbb_status.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; const _kBorderRadius = 2.0; -@Deprecated('will soon be moved to the web package') +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBStatus extends StatelessWidget { const SBBStatus.valid({ Key? key, diff --git a/lib/src/theme/sbb_typography.dart b/lib/src/theme/sbb_typography.dart index a237c795..053b5e8d 100644 --- a/lib/src/theme/sbb_typography.dart +++ b/lib/src/theme/sbb_typography.dart @@ -99,9 +99,10 @@ class SBBTextStyles { ); } +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBLeanTextStyles { SBBLeanTextStyles._(); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle headerTitle = TextStyle( fontSize: 15.0, fontStyle: FontStyle.normal, @@ -109,7 +110,7 @@ class SBBLeanTextStyles { fontFamily: SBBWebFont, color: SBBColors.black, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle headerSubtitle = TextStyle( fontSize: 13.0, fontStyle: FontStyle.normal, @@ -117,7 +118,7 @@ class SBBLeanTextStyles { fontFamily: SBBWebFont, color: SBBColors.metal, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle contextMenu = TextStyle( fontSize: 15.0, fontStyle: FontStyle.normal, @@ -125,7 +126,7 @@ class SBBLeanTextStyles { fontFamily: SBBWebFont, color: SBBColors.iron, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle userMenuInitials = TextStyle( fontSize: 10.0, fontStyle: FontStyle.normal, @@ -133,7 +134,7 @@ class SBBLeanTextStyles { fontFamily: SBBWebFont, color: SBBColors.metal, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle breadcrumb = TextStyle( fontSize: 13.0, fontStyle: FontStyle.normal, @@ -142,6 +143,7 @@ class SBBLeanTextStyles { ); } +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBWebTextStyles { SBBWebTextStyles._(); @@ -177,7 +179,7 @@ class SBBWebTextStyles { height: 19.0 / 16.0, color: SBBColors.black, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle _running = TextStyle( fontSize: 15.0, fontStyle: FontStyle.normal, @@ -186,35 +188,35 @@ class SBBWebTextStyles { height: 23.0 / 15.0, color: SBBColors.black, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle medium = TextStyle( fontSize: 15.0, fontStyle: FontStyle.normal, fontWeight: FontWeight.w400, fontFamily: SBBWebFont, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle small = TextStyle( fontSize: 13.0, fontStyle: FontStyle.normal, fontWeight: FontWeight.w400, fontFamily: SBBWebFont, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle extraSmallBold = TextStyle( fontSize: 10.0, fontStyle: FontStyle.normal, fontWeight: FontWeight.w700, fontFamily: SBBWebFont, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle mediumLight = TextStyle( fontSize: 15.0, fontStyle: FontStyle.normal, fontWeight: FontWeight.w300, fontFamily: SBBWebFont, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle dropdownLabel = TextStyle( fontSize: 13.0, fontStyle: FontStyle.normal, @@ -222,7 +224,7 @@ class SBBWebTextStyles { fontFamily: SBBWebFont, color: SBBColors.granite, ); - + @Deprecated('FlutterWeb will not be supported from the next major release.') static const TextStyle accordionHeader = TextStyle( fontSize: 21.0, fontStyle: FontStyle.normal, @@ -232,7 +234,9 @@ class SBBWebTextStyles { ); } +@Deprecated('FlutterWeb will not be supported from the next major release.') class SBBWebText extends StatelessWidget { + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebText.headerOne( this.data, { Key? key, @@ -242,7 +246,7 @@ class SBBWebText extends StatelessWidget { top: SBBWebDivider.big, bottom: SBBWebDivider.medium), this.selectable = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebText.headerTwo( this.data, { Key? key, @@ -252,7 +256,7 @@ class SBBWebText extends StatelessWidget { top: SBBWebDivider.medium, bottom: SBBWebDivider.small), this.selectable = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebText.headerThree( this.data, { Key? key, @@ -262,7 +266,7 @@ class SBBWebText extends StatelessWidget { top: SBBWebDivider.small, bottom: SBBWebDivider.thin), this.selectable = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebText.headerFour( this.data, { Key? key, @@ -272,7 +276,7 @@ class SBBWebText extends StatelessWidget { top: SBBWebDivider.small, bottom: SBBWebDivider.thin), this.selectable = false, }) : super(key: key); - + @Deprecated('FlutterWeb will not be supported from the next major release.') const SBBWebText.running( this.data, { Key? key,