From 0e1d4c31335236ad8dc972a7a3c1faa8c149fb7b Mon Sep 17 00:00:00 2001 From: Souvik Biswas Date: Wed, 3 Jul 2024 22:59:21 +0530 Subject: [PATCH 1/3] Remove theme from this library for now --- lib/flutterflow_ui.dart | 1 - lib/src/themes/flutter_flow_theme.dart | 139 ------------------------- 2 files changed, 140 deletions(-) delete mode 100644 lib/src/themes/flutter_flow_theme.dart diff --git a/lib/flutterflow_ui.dart b/lib/flutterflow_ui.dart index 25d232c..d7f4f7c 100644 --- a/lib/flutterflow_ui.dart +++ b/lib/flutterflow_ui.dart @@ -1,5 +1,4 @@ library flutterflow_ui; -export 'src/themes/flutter_flow_theme.dart'; export 'src/utils/flutter_flow_utils.dart'; export 'src/widgets/flutter_flow_widgets.dart'; diff --git a/lib/src/themes/flutter_flow_theme.dart b/lib/src/themes/flutter_flow_theme.dart deleted file mode 100644 index a75446a..0000000 --- a/lib/src/themes/flutter_flow_theme.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; - -enum DeviceSize { - mobile, - tablet, - desktop, -} - -DeviceSize getDeviceSize(BuildContext context) { - final width = MediaQuery.sizeOf(context).width; - if (width < 479) { - return DeviceSize.mobile; - } else if (width < 991) { - return DeviceSize.tablet; - } else { - return DeviceSize.desktop; - } -} - -mixin FFTheme { - Color get primary; - Color get secondary; - Color get tertiary; - Color get alternate; - Color get primaryText; - Color get secondaryText; - Color get primaryBackground; - Color get secondaryBackground; - Color get accent1; - Color get accent2; - Color get accent3; - Color get accent4; - Color get success; - Color get warning; - Color get error; - Color get info; - - String get displayLargeFamily => typography.displayLargeFamily; - TextStyle get displayLarge => typography.displayLarge; - String get displayMediumFamily => typography.displayMediumFamily; - TextStyle get displayMedium => typography.displayMedium; - String get displaySmallFamily => typography.displaySmallFamily; - TextStyle get displaySmall => typography.displaySmall; - String get headlineLargeFamily => typography.headlineLargeFamily; - TextStyle get headlineLarge => typography.headlineLarge; - String get headlineMediumFamily => typography.headlineMediumFamily; - TextStyle get headlineMedium => typography.headlineMedium; - String get headlineSmallFamily => typography.headlineSmallFamily; - TextStyle get headlineSmall => typography.headlineSmall; - String get titleLargeFamily => typography.titleLargeFamily; - TextStyle get titleLarge => typography.titleLarge; - String get titleMediumFamily => typography.titleMediumFamily; - TextStyle get titleMedium => typography.titleMedium; - String get titleSmallFamily => typography.titleSmallFamily; - TextStyle get titleSmall => typography.titleSmall; - String get labelLargeFamily => typography.labelLargeFamily; - TextStyle get labelLarge => typography.labelLarge; - String get labelMediumFamily => typography.labelMediumFamily; - TextStyle get labelMedium => typography.labelMedium; - String get labelSmallFamily => typography.labelSmallFamily; - TextStyle get labelSmall => typography.labelSmall; - String get bodyLargeFamily => typography.bodyLargeFamily; - TextStyle get bodyLarge => typography.bodyLarge; - String get bodyMediumFamily => typography.bodyMediumFamily; - TextStyle get bodyMedium => typography.bodyMedium; - String get bodySmallFamily => typography.bodySmallFamily; - TextStyle get bodySmall => typography.bodySmall; - - FFTypography get typography; -} - -mixin FFTypography { - String get displayLargeFamily; - TextStyle get displayLarge; - String get displayMediumFamily; - TextStyle get displayMedium; - String get displaySmallFamily; - TextStyle get displaySmall; - String get headlineLargeFamily; - TextStyle get headlineLarge; - String get headlineMediumFamily; - TextStyle get headlineMedium; - String get headlineSmallFamily; - TextStyle get headlineSmall; - String get titleLargeFamily; - TextStyle get titleLarge; - String get titleMediumFamily; - TextStyle get titleMedium; - String get titleSmallFamily; - TextStyle get titleSmall; - String get labelLargeFamily; - TextStyle get labelLarge; - String get labelMediumFamily; - TextStyle get labelMedium; - String get labelSmallFamily; - TextStyle get labelSmall; - String get bodyLargeFamily; - TextStyle get bodyLarge; - String get bodyMediumFamily; - TextStyle get bodyMedium; - String get bodySmallFamily; - TextStyle get bodySmall; -} - -extension TextStyleHelper on TextStyle { - TextStyle override({ - String? fontFamily, - Color? color, - double? fontSize, - FontWeight? fontWeight, - double? letterSpacing, - FontStyle? fontStyle, - bool useGoogleFonts = true, - TextDecoration? decoration, - double? lineHeight, - }) => - useGoogleFonts - ? GoogleFonts.getFont( - fontFamily!, - color: color ?? this.color, - fontSize: fontSize ?? this.fontSize, - letterSpacing: letterSpacing ?? this.letterSpacing, - fontWeight: fontWeight ?? this.fontWeight, - fontStyle: fontStyle ?? this.fontStyle, - decoration: decoration, - height: lineHeight, - ) - : copyWith( - fontFamily: fontFamily, - color: color, - fontSize: fontSize, - letterSpacing: letterSpacing, - fontWeight: fontWeight, - fontStyle: fontStyle, - decoration: decoration, - height: lineHeight, - ); -} From 452669296ab8970269a082bd68ace171df3f79cd Mon Sep 17 00:00:00 2001 From: Souvik Biswas Date: Thu, 4 Jul 2024 12:09:15 +0530 Subject: [PATCH 2/3] Fix the version of Mux dependency --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index d52af6a..3b3a565 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: aligned_dialog: ^0.0.6 aligned_tooltip: ^0.0.1 - apivideo_live_stream: ^1.0.7 + apivideo_live_stream: 1.0.7 assets_audio_player: ^3.1.1 assets_audio_player_web: ^3.1.1 auto_size_text: ^3.0.0 From 22bc57bb742c3f8368123903d90b46f48aace0e0 Mon Sep 17 00:00:00 2001 From: Souvik Biswas Date: Thu, 4 Jul 2024 21:54:08 +0530 Subject: [PATCH 3/3] Upgrade to version 0.3.1 * Remove the audio player support from the package * Some code quality improvements --- CHANGELOG.md | 4 + lib/src/utils/flutter_flow_animations.dart | 9 +- lib/src/utils/flutter_flow_helpers.dart | 8 +- lib/src/utils/flutter_flow_model.dart | 12 +- lib/src/utils/internationalization.dart | 4 +- lib/src/widgets/flutter_flow_ad_banner.dart | 4 +- .../widgets/flutter_flow_audio_player.dart | 443 ------------------ lib/src/widgets/flutter_flow_calendar.dart | 4 +- lib/src/widgets/flutter_flow_charts.dart | 8 +- lib/src/widgets/flutter_flow_data_table.dart | 14 +- lib/src/widgets/flutter_flow_drop_down.dart | 4 +- lib/src/widgets/flutter_flow_icon_button.dart | 22 +- .../flutter_flow_language_selector.dart | 2 +- lib/src/widgets/flutter_flow_widgets.dart | 1 - pubspec.yaml | 7 +- 15 files changed, 50 insertions(+), 496 deletions(-) delete mode 100644 lib/src/widgets/flutter_flow_audio_player.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 68f9535..f906f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1 + +- Remove audio player support from the package + ## 0.3.0 - Add support for new UI widgets available in current FlutterFlow release diff --git a/lib/src/utils/flutter_flow_animations.dart b/lib/src/utils/flutter_flow_animations.dart index c4550d0..570c82c 100644 --- a/lib/src/utils/flutter_flow_animations.dart +++ b/lib/src/utils/flutter_flow_animations.dart @@ -70,15 +70,12 @@ extension AnimatedWidgetExtension on Widget { class TiltEffect extends Effect { const TiltEffect({ - Duration? delay, - Duration? duration, - Curve? curve, + super.delay, + super.duration, + super.curve, Offset? begin, Offset? end, }) : super( - delay: delay, - duration: duration, - curve: curve, begin: begin ?? const Offset(0.0, 0.0), end: end ?? const Offset(0.0, 0.0), ); diff --git a/lib/src/utils/flutter_flow_helpers.dart b/lib/src/utils/flutter_flow_helpers.dart index dacefc4..29713ce 100644 --- a/lib/src/utils/flutter_flow_helpers.dart +++ b/lib/src/utils/flutter_flow_helpers.dart @@ -189,7 +189,7 @@ bool responsiveVisibility({ const kTextValidatorUsernameRegex = r'^[a-zA-Z][a-zA-Z0-9_-]{2,16}$'; // https://stackoverflow.com/a/201378 const kTextValidatorEmailRegex = - "^(?:[a-z0-9!#\$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&\'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\$"; + "^(?:[a-z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])\$"; const kTextValidatorWebsiteRegex = r'(https?:\/\/)?(www\.)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)|(https?:\/\/)?(www\.)?(?!ww)[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,10}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)'; @@ -218,12 +218,12 @@ void showSnackbar( content: Row( children: [ if (loading) - Padding( + const Padding( padding: EdgeInsetsDirectional.only(end: 10.0), - child: Container( + child: SizedBox( height: 20, width: 20, - child: const CircularProgressIndicator( + child: CircularProgressIndicator( color: Colors.white, ), ), diff --git a/lib/src/utils/flutter_flow_model.dart b/lib/src/utils/flutter_flow_model.dart index 6e0bea1..c38a4fa 100644 --- a/lib/src/utils/flutter_flow_model.dart +++ b/lib/src/utils/flutter_flow_model.dart @@ -44,7 +44,9 @@ abstract class FlutterFlowModel { initState(context); _isInitialized = true; } - if (context.widget is W) _widget = context.widget as W; + if (context.widget is W) { + _widget = context.widget as W; + } } // The widget associated with this model. This is useful for accessing the @@ -151,13 +153,13 @@ class FlutterFlowDynamicModels { T? _getDefaultValue() { switch (T) { - case int: + case const (int): return 0 as T; - case double: + case const (double): return 0.0 as T; - case String: + case const (String): return '' as T; - case bool: + case const (bool): return false as T; default: return null as T; diff --git a/lib/src/utils/internationalization.dart b/lib/src/utils/internationalization.dart index a6c8a22..21cfcfe 100644 --- a/lib/src/utils/internationalization.dart +++ b/lib/src/utils/internationalization.dart @@ -1,5 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; //Helper class for internationalization class FFLocalizations { @@ -9,7 +9,7 @@ class FFLocalizations { //Initializing static FFLocalizations of(BuildContext context) => - FFLocalizations(Locale('en')); + FFLocalizations(const Locale('en')); static List languages() => ['en']; diff --git a/lib/src/widgets/flutter_flow_ad_banner.dart b/lib/src/widgets/flutter_flow_ad_banner.dart index 75a42dc..f9c8ec6 100644 --- a/lib/src/widgets/flutter_flow_ad_banner.dart +++ b/lib/src/widgets/flutter_flow_ad_banner.dart @@ -135,8 +135,8 @@ class _FlutterFlowAdBannerState extends State { print('\$BannerAd failedToLoad: \$error'); ad.dispose(); }, - onAdOpened: (Ad ad) => print('\$BannerAd onAdOpened.'), - onAdClosed: (Ad ad) => print('\$BannerAd onAdClosed.'), + onAdOpened: (ad) => print('\$BannerAd onAdOpened.'), + onAdClosed: (ad) => print('\$BannerAd onAdClosed.'), ), ); await banner.load(); diff --git a/lib/src/widgets/flutter_flow_audio_player.dart b/lib/src/widgets/flutter_flow_audio_player.dart deleted file mode 100644 index 3bd232a..0000000 --- a/lib/src/widgets/flutter_flow_audio_player.dart +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright 2019 Florent37 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * The source code used herein has been modified and added to. - */ - -import 'dart:math' as math; -import 'package:assets_audio_player/assets_audio_player.dart'; -import 'package:flutter/material.dart'; -import 'package:flutterflow_ui/src/utils/flutter_flow_helpers.dart' - show routeObserver; - -export 'package:assets_audio_player/assets_audio_player.dart'; - -/// A widget that displays an audio player with playback controls and a seek bar. -/// -/// The [FlutterFlowAudioPlayer] widget is used to play audio files. It provides -/// playback controls such as play/pause button, title, and playback duration. -/// It also includes a seek bar to allow users to seek to a specific position -/// in the audio file. -/// -/// The [FlutterFlowAudioPlayer] requires an [Audio] object to specify the audio -/// file to be played. It also accepts various customization options such as -/// text styles, colors, elevation, and more. -/// -/// Example usage: -/// ```dart -/// FlutterFlowAudioPlayer( -/// audio: Audio( -/// path: 'path/to/audio.mp3', -/// audioType: AudioType.network, -/// ), -/// titleTextStyle: TextStyle( -/// fontSize: 16, -/// fontWeight: FontWeight.bold, -/// ), -/// playbackDurationTextStyle: TextStyle( -/// fontSize: 14, -/// color: Colors.grey, -/// ), -/// fillColor: Colors.white, -/// playbackButtonColor: Colors.blue, -/// activeTrackColor: Colors.blue, -/// elevation: 4, -/// pauseOnNavigate: true, -/// playInBackground: PlayInBackground.enabled, -/// ) -/// ``` -class FlutterFlowAudioPlayer extends StatefulWidget { - /// Creates a [FlutterFlowAudioPlayer] widget. - /// - /// - [audio] parameter is required and specifies the audio file to be played. - /// - [titleTextStyle] and [playbackDurationTextStyle] parameters are required - /// and define the text styles for the title and playback duration respectively. - /// - [fillColor], [playbackButtonColor], [activeTrackColor], and [inactiveTrackColor] - /// parameters are used to customize the colors of the audio player. - /// - [elevation] parameter specifies the elevation of the audio player. - /// - [pauseOnNavigate] parameter determines whether the audio should be paused - /// when navigating to a different screen. - /// - [playInBackground] parameter specifies whether the audio should continue - /// playing in the background when the app is not in the foreground. - const FlutterFlowAudioPlayer({ - super.key, - required this.audio, - required this.titleTextStyle, - required this.playbackDurationTextStyle, - required this.fillColor, - required this.playbackButtonColor, - required this.activeTrackColor, - this.inactiveTrackColor, - required this.elevation, - this.pauseOnNavigate = true, - required this.playInBackground, - }); - - final Audio audio; - final TextStyle titleTextStyle; - final TextStyle playbackDurationTextStyle; - final Color fillColor; - final Color playbackButtonColor; - final Color activeTrackColor; - final Color? inactiveTrackColor; - final double elevation; - final bool pauseOnNavigate; - final PlayInBackground playInBackground; - - @override - State createState() => _FlutterFlowAudioPlayerState(); -} - -class _FlutterFlowAudioPlayerState extends State - with RouteAware { - AssetsAudioPlayer? _assetsAudioPlayer; - bool _subscribedRoute = false; - - @override - void initState() { - super.initState(); - openPlayer(); - } - - Future openPlayer() async { - _assetsAudioPlayer ??= - AssetsAudioPlayer.withId(generateRandomAlphaNumericString()); - if (_assetsAudioPlayer?.playlist != null) { - _assetsAudioPlayer!.playlist!.replaceAt(0, (oldAudio) => widget.audio); - } else { - await _assetsAudioPlayer!.open( - Playlist(audios: [widget.audio]), - autoStart: false, - playInBackground: widget.playInBackground, - ); - } - } - - @override - void dispose() { - if (_subscribedRoute) { - routeObserver.unsubscribe(this); - } - _assetsAudioPlayer?.dispose(); - super.dispose(); - } - - @override - void didUpdateWidget(FlutterFlowAudioPlayer old) { - super.didUpdateWidget(old); - final changed = old.audio.path != widget.audio.path || - old.audio.audioType != widget.audio.audioType; - final isPlaying = _assetsAudioPlayer?.isPlaying.value ?? false; - if (changed && !isPlaying) { - openPlayer(); - } - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - if (widget.pauseOnNavigate && ModalRoute.of(context) is PageRoute) { - _subscribedRoute = true; - routeObserver.subscribe(this, ModalRoute.of(context)!); - } - } - - @override - void didPushNext() { - if (widget.pauseOnNavigate) { - _assetsAudioPlayer?.pause(); - } - } - - Duration currentPosition(RealtimePlayingInfos infos) => - infos.currentPosition.ensureFinite; - Duration duration(RealtimePlayingInfos infos) => infos.duration.ensureFinite; - - String playbackStateText(RealtimePlayingInfos infos) { - final currentPositionString = durationToString(currentPosition(infos)); - final durationString = durationToString(duration(infos)); - return '$currentPositionString/$durationString'; - } - - @override - Widget build(BuildContext context) => - _assetsAudioPlayer!.builderRealtimePlayingInfos( - builder: (context, infos) => PlayerBuilder.isPlaying( - player: _assetsAudioPlayer!, - builder: (context, isPlaying) { - final childWidget = Container( - width: double.infinity, - decoration: BoxDecoration( - color: widget.fillColor, - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 15, 10, 0, 0), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.audio.metas.title ?? 'Audio Title', - style: widget.titleTextStyle, - ), - Text( - playbackStateText(infos), - style: widget.playbackDurationTextStyle, - ) - ], - ), - ), - ), - ClipRRect( - borderRadius: BorderRadius.circular(34), - child: Material( - color: Colors.transparent, - child: IconButton( - onPressed: _assetsAudioPlayer!.playOrPause, - icon: Icon( - isPlaying - ? Icons.pause_circle_filled_rounded - : Icons.play_circle_fill_rounded, - color: widget.playbackButtonColor, - size: 34, - ), - iconSize: 34, - ), - ), - ), - ], - ), - PositionSeekWidget( - currentPosition: currentPosition(infos), - duration: duration(infos), - seekTo: (to) { - _assetsAudioPlayer!.seek(to); - }, - activeTrackColor: widget.activeTrackColor, - inactiveTrackColor: widget.inactiveTrackColor, - ), - ], - ), - ); - return Material( - color: Colors.transparent, - elevation: widget.elevation, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: childWidget); - })); -} - -/// Widget that represents the position seek bar in the audio player. -class PositionSeekWidget extends StatefulWidget { - const PositionSeekWidget({ - super.key, - required this.currentPosition, - required this.duration, - required this.seekTo, - required this.activeTrackColor, - this.inactiveTrackColor, - }); - - /// The current position of the audio playback. - final Duration currentPosition; - - /// The total duration of the audio. - final Duration duration; - - /// Callback function to seek to a specific position in the audio. - final Function(Duration) seekTo; - - /// The color of the active track in the seek bar. - final Color activeTrackColor; - - /// The color of the inactive track in the seek bar. - final Color? inactiveTrackColor; - - @override - State createState() => _PositionSeekWidgetState(); -} - -class _PositionSeekWidgetState extends State { - late Duration _visibleValue; - bool listenOnlyUserInteraction = false; - - /// The percentage of the current position in relation to the total duration. - double get percent => widget.duration.inMilliseconds == 0 - ? 0 - : _visibleValue.inMilliseconds / widget.duration.inMilliseconds; - - @override - void initState() { - super.initState(); - _visibleValue = widget.currentPosition; - } - - @override - void didUpdateWidget(PositionSeekWidget oldWidget) { - super.didUpdateWidget(oldWidget); - if (!listenOnlyUserInteraction) { - _visibleValue = widget.currentPosition; - } - } - - @override - Widget build(BuildContext context) => SliderTheme( - data: SliderTheme.of(context).copyWith( - activeTrackColor: widget.activeTrackColor, - inactiveTrackColor: - widget.inactiveTrackColor ?? const Color(0xFFC9D0D5), - trackShape: const FlutterFlowRoundedRectSliderTrackShape(), - trackHeight: 6.0, - thumbShape: SliderComponentShape.noThumb, - overlayColor: const Color(0xFF57636C).withAlpha(32), - overlayShape: const RoundSliderOverlayShape(overlayRadius: 12.0), - ), - child: Slider( - min: 0, - max: widget.duration.inMilliseconds.toDouble(), - value: math.min(1.0, percent) * - widget.duration.inMilliseconds.toDouble(), - onChangeEnd: (newValue) => setState(() { - listenOnlyUserInteraction = false; - widget.seekTo(_visibleValue); - }), - onChangeStart: (_) => - setState(() => listenOnlyUserInteraction = true), - onChanged: (newValue) => setState( - () => _visibleValue = Duration(milliseconds: newValue.floor())), - ), - ); -} - -/// Converts a [Duration] object to a formatted string in the format "mm:ss". -String durationToString(Duration duration) { - String twoDigits(int n) => (n >= 10) ? '$n' : '0$n'; - - final twoDigitMinutes = - twoDigits(duration.inMinutes.remainder(Duration.minutesPerHour).toInt()); - final twoDigitSeconds = twoDigits( - duration.inSeconds.remainder(Duration.secondsPerMinute).toInt()); - return '$twoDigitMinutes:$twoDigitSeconds'; -} - -/// Custom slider track shape for the audio player seek bar. -class FlutterFlowRoundedRectSliderTrackShape extends SliderTrackShape - with BaseSliderTrackShape { - /// Create a slider track that draws two rectangles with rounded outer edges. - const FlutterFlowRoundedRectSliderTrackShape(); - - @override - void paint( - PaintingContext context, - Offset offset, { - required RenderBox parentBox, - Offset? secondaryOffset, - required SliderThemeData sliderTheme, - required Animation enableAnimation, - required TextDirection textDirection, - required Offset thumbCenter, - bool isDiscrete = false, - bool isEnabled = false, - double additionalActiveTrackHeight = 0, - }) { - assert(sliderTheme.disabledActiveTrackColor != null); - assert(sliderTheme.disabledInactiveTrackColor != null); - assert(sliderTheme.activeTrackColor != null); - assert(sliderTheme.inactiveTrackColor != null); - assert(sliderTheme.thumbShape != null); - // If the slider [SliderThemeData.trackHeight] is less than or equal to 0, - // then it makes no difference whether the track is painted or not, - // therefore the painting can be a no-op. - if (sliderTheme.trackHeight == null || sliderTheme.trackHeight! <= 0) { - return; - } - - // Assign the track segment paints, which are leading: active and - // trailing: inactive. - final ColorTween activeTrackColorTween = ColorTween( - begin: sliderTheme.disabledActiveTrackColor, - end: sliderTheme.activeTrackColor); - final ColorTween inactiveTrackColorTween = ColorTween( - begin: sliderTheme.disabledInactiveTrackColor, - end: sliderTheme.inactiveTrackColor); - final Paint activePaint = Paint() - ..color = activeTrackColorTween.evaluate(enableAnimation)!; - final Paint inactivePaint = Paint() - ..color = inactiveTrackColorTween.evaluate(enableAnimation)!; - final Paint leftTrackPaint = activePaint; - final Paint rightTrackPaint = inactivePaint; - - final Rect trackRect = getPreferredRect( - parentBox: parentBox, - offset: offset, - sliderTheme: sliderTheme, - isEnabled: isEnabled, - isDiscrete: isDiscrete, - ); - const Radius trackRadius = Radius.circular(2.0); - const Radius activeTrackRadius = Radius.circular(2.0); - - context.canvas.drawRRect( - RRect.fromLTRBAndCorners( - thumbCenter.dx - activeTrackRadius.x, - trackRect.top, - trackRect.right, - trackRect.bottom, - topRight: trackRadius, - bottomRight: trackRadius, - topLeft: activeTrackRadius, - bottomLeft: activeTrackRadius, - ), - rightTrackPaint, - ); - context.canvas.drawRRect( - RRect.fromLTRBAndCorners( - trackRect.left, - trackRect.top - (additionalActiveTrackHeight / 2), - thumbCenter.dx, - trackRect.bottom + (additionalActiveTrackHeight / 2), - topLeft: activeTrackRadius, - bottomLeft: activeTrackRadius, - topRight: trackRadius, - bottomRight: trackRadius, - ), - leftTrackPaint, - ); - } -} - -/// Generates a random alphanumeric string of length 8. -String generateRandomAlphaNumericString() { - const chars = 'abcdefghijklmnopqrstuvwxyz1234567890'; - return String.fromCharCodes(Iterable.generate( - 8, (_) => chars.codeUnits[math.Random().nextInt(chars.length)])); -} - -extension _AudioPlayerDurationExtensions on Duration { - /// Ensures that the duration is finite by returning [Duration.zero] if it is not. - Duration get ensureFinite => inMicroseconds.isFinite ? this : Duration.zero; -} diff --git a/lib/src/widgets/flutter_flow_calendar.dart b/lib/src/widgets/flutter_flow_calendar.dart index 041e4bb..8b79219 100644 --- a/lib/src/widgets/flutter_flow_calendar.dart +++ b/lib/src/widgets/flutter_flow_calendar.dart @@ -209,9 +209,9 @@ class _FlutterFlowCalendarState extends State { defaultTextStyle: widget.dateStyle ?? const TextStyle(color: Color(0xFF5A5A5A)), weekendTextStyle: widget.dateStyle ?? - const TextStyle(color: const Color(0xFF5A5A5A)), + const TextStyle(color: Color(0xFF5A5A5A)), holidayTextStyle: widget.dateStyle ?? - const TextStyle(color: const Color(0xFF5C6BC0)), + const TextStyle(color: Color(0xFF5C6BC0)), selectedTextStyle: const TextStyle(color: Color(0xFFFAFAFA), fontSize: 16.0) .merge(widget.selectedDateStyle), diff --git a/lib/src/widgets/flutter_flow_charts.dart b/lib/src/widgets/flutter_flow_charts.dart index d8ecedc..e4a702d 100644 --- a/lib/src/widgets/flutter_flow_charts.dart +++ b/lib/src/widgets/flutter_flow_charts.dart @@ -543,8 +543,8 @@ FlTitlesData getTitlesData( ? xAxisLabelInfo.titleTextStyle!.fontSize! + 12 : 16, sideTitles: SideTitles( - getTitlesWidget: (val, _) => getXTitlesWidget != null - ? getXTitlesWidget(val, _) + getTitlesWidget: (val, meta) => getXTitlesWidget != null + ? getXTitlesWidget(val, meta) : Text( formatLabel(xAxisLabelInfo.labelFormatter, val), style: xAxisLabelInfo.labelTextStyle, @@ -554,8 +554,8 @@ FlTitlesData getTitlesData( reservedSize: xAxisLabelInfo.reservedSize ?? 22, ), ), - rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), - topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), + rightTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), + topTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), leftTitles: AxisTitles( axisNameWidget: yAxisLabelInfo.title.isEmpty ? null diff --git a/lib/src/widgets/flutter_flow_data_table.dart b/lib/src/widgets/flutter_flow_data_table.dart index 9d8ad94..b4889fb 100644 --- a/lib/src/widgets/flutter_flow_data_table.dart +++ b/lib/src/widgets/flutter_flow_data_table.dart @@ -242,24 +242,24 @@ class _FlutterFlowDataTableState extends State> { ); final checkboxThemeData = CheckboxThemeData( - checkColor: MaterialStateProperty.all( + checkColor: WidgetStateProperty.all( widget.checkboxCheckColor ?? Colors.black54, ), - fillColor: MaterialStateProperty.resolveWith( - (states) => states.contains(MaterialState.selected) + fillColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) ? widget.checkboxSelectedFillColor ?? Colors.white.withOpacity(0.01) : widget.checkboxUnselectedFillColor ?? Colors.white.withOpacity(0.01), ), - side: MaterialStateBorderSide.resolveWith( + side: WidgetStateBorderSide.resolveWith( (states) => BorderSide( width: 2.0, - color: states.contains(MaterialState.selected) + color: states.contains(WidgetState.selected) ? widget.checkboxSelectedBorderColor ?? Colors.black54 : widget.checkboxUnselectedBorderColor ?? Colors.black54, ), ), - overlayColor: MaterialStateProperty.all(Colors.transparent), + overlayColor: WidgetStateProperty.all(Colors.transparent), ); final horizontalBorder = widget.addHorizontalDivider @@ -321,7 +321,7 @@ class _FlutterFlowDataTableState extends State> { : BorderSide.none, ), dividerThickness: widget.hideDefaultHorizontalDivider ? 0.0 : null, - headingRowColor: MaterialStateProperty.all(widget.headingRowColor), + headingRowColor: WidgetStateProperty.all(widget.headingRowColor), headingRowHeight: widget.headingRowHeight, dataRowHeight: widget.dataRowHeight, showFirstLastButtons: widget.showFirstLastButtons, diff --git a/lib/src/widgets/flutter_flow_drop_down.dart b/lib/src/widgets/flutter_flow_drop_down.dart index 6783df8..f7211f9 100644 --- a/lib/src/widgets/flutter_flow_drop_down.dart +++ b/lib/src/widgets/flutter_flow_drop_down.dart @@ -330,8 +330,8 @@ class _FlutterFlowDropDownState extends State> { .toList(); Widget _buildDropdown() { - final overlayColor = MaterialStateProperty.resolveWith((states) => - states.contains(MaterialState.focused) ? Colors.transparent : null); + final overlayColor = WidgetStateProperty.resolveWith((states) => + states.contains(WidgetState.focused) ? Colors.transparent : null); final iconStyleData = widget.icon != null ? IconStyleData(icon: widget.icon!) : const IconStyleData(); diff --git a/lib/src/widgets/flutter_flow_icon_button.dart b/lib/src/widgets/flutter_flow_icon_button.dart index e632449..072ead5 100644 --- a/lib/src/widgets/flutter_flow_icon_button.dart +++ b/lib/src/widgets/flutter_flow_icon_button.dart @@ -92,7 +92,7 @@ class _FlutterFlowIconButtonState extends State { @override Widget build(BuildContext context) { ButtonStyle style = ButtonStyle( - shape: MaterialStateProperty.resolveWith( + shape: WidgetStateProperty.resolveWith( (states) { return RoundedRectangleBorder( borderRadius: BorderRadius.circular(widget.borderRadius ?? 0), @@ -103,26 +103,26 @@ class _FlutterFlowIconButtonState extends State { ); }, ), - iconColor: MaterialStateProperty.resolveWith( + iconColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(MaterialState.disabled) && + if (states.contains(WidgetState.disabled) && widget.disabledIconColor != null) { return widget.disabledIconColor; } - if (states.contains(MaterialState.hovered) && + if (states.contains(WidgetState.hovered) && widget.hoverIconColor != null) { return widget.hoverIconColor; } return iconColor; }, ), - backgroundColor: MaterialStateProperty.resolveWith( + backgroundColor: WidgetStateProperty.resolveWith( (states) { - if (states.contains(MaterialState.disabled) && + if (states.contains(WidgetState.disabled) && widget.disabledColor != null) { return widget.disabledColor; } - if (states.contains(MaterialState.hovered) && + if (states.contains(WidgetState.hovered) && widget.hoverColor != null) { return widget.hoverColor; } @@ -130,8 +130,8 @@ class _FlutterFlowIconButtonState extends State { return widget.fillColor; }, ), - overlayColor: MaterialStateProperty.resolveWith((states) { - if (states.contains(MaterialState.pressed)) { + overlayColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { return null; } return widget.hoverColor == null ? null : Colors.transparent; @@ -147,10 +147,10 @@ class _FlutterFlowIconButtonState extends State { useMaterial3: true, ), child: IgnorePointer( - ignoring: (widget.showLoadingIndicator && loading), + ignoring: widget.showLoadingIndicator && loading, child: IconButton( icon: (widget.showLoadingIndicator && loading) - ? Container( + ? SizedBox( width: iconSize, height: iconSize, child: CircularProgressIndicator( diff --git a/lib/src/widgets/flutter_flow_language_selector.dart b/lib/src/widgets/flutter_flow_language_selector.dart index c83228c..70c9636 100644 --- a/lib/src/widgets/flutter_flow_language_selector.dart +++ b/lib/src/widgets/flutter_flow_language_selector.dart @@ -128,7 +128,7 @@ class _LanguagePickerItem extends StatelessWidget { } flagWidget = Transform.scale( scale: flagSize / 24.0, - child: Container( + child: SizedBox( width: 24, child: flagWidget, ), diff --git a/lib/src/widgets/flutter_flow_widgets.dart b/lib/src/widgets/flutter_flow_widgets.dart index c8f6895..2723377 100644 --- a/lib/src/widgets/flutter_flow_widgets.dart +++ b/lib/src/widgets/flutter_flow_widgets.dart @@ -1,5 +1,4 @@ export 'flutter_flow_ad_banner.dart'; -export 'flutter_flow_audio_player.dart'; export 'flutter_flow_autocomplete_options_list.dart'; export 'flutter_flow_button.dart'; export 'flutter_flow_button_tabbar.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 3b3a565..ba00a28 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutterflow_ui description: Flutter package that makes it easy to use UI widgets and code generated by FlutterFlow in your Flutter projects. homepage: https://docs.flutterflow.io repository: https://github.com/FlutterFlow/flutterflow-ui -version: 0.3.0 +version: 0.3.1 environment: sdk: ">=3.0.0 <4.0.0" @@ -11,8 +11,6 @@ dependencies: aligned_dialog: ^0.0.6 aligned_tooltip: ^0.0.1 apivideo_live_stream: 1.0.7 - assets_audio_player: ^3.1.1 - assets_audio_player_web: ^3.1.1 auto_size_text: ^3.0.0 barcode_widget: ^2.0.3 cached_network_image: ^3.3.1 @@ -78,9 +76,6 @@ dependencies: webview_flutter_wkwebview: ^3.12.0 webviewx_plus: ^0.5.0 -dependency_overrides: - uuid: ^4.0.0 - dev_dependencies: flutter_lints: ^4.0.0