diff options
author | Lisandro Pérez Meyer <lpmeyer@ics.com> | 2023-11-16 22:44:34 -0300 |
---|---|---|
committer | Lisandro Perez Meyer <lpmeyer@ics.com> | 2023-11-17 01:48:26 +0000 |
commit | 4d77bab5a0f698943d1abf74482eecef7cc95f08 (patch) | |
tree | 49e0a590b5903cc7553b1a4fc3cb2fbcd13cebf4 | |
parent | 6a00ac1f8613048b5c1f7ecdbd1adcbbcfdca5ed (diff) |
Bug fixes. Fixed Fan mode selection off state bug.
Fixes ICS' internal AGL-48,49,50.
Original from Sabin Sajeevan <ssajeevan@ics.com>
Bug-AGL: SPEC-4971
Change-Id: I66c875551a69a1b53eee2d6e1d3fa725b20ff41b
Signed-off-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
19 files changed, 410 insertions, 166 deletions
diff --git a/lib/data/data_providers/app_provider.dart b/lib/data/data_providers/app_provider.dart index c528a1a..80416a4 100644 --- a/lib/data/data_providers/app_provider.dart +++ b/lib/data/data_providers/app_provider.dart @@ -1,6 +1,7 @@ import 'package:flutter_ics_homescreen/data/data_providers/datetime_notifier.dart'; import 'package:flutter_ics_homescreen/data/data_providers/hybrid_notifier.dart'; import 'package:flutter_ics_homescreen/data/data_providers/signal_notifier.dart'; +import 'package:flutter_ics_homescreen/data/data_providers/time_notifier.dart'; import 'package:flutter_ics_homescreen/data/data_providers/units_notifier.dart'; import 'package:flutter_ics_homescreen/data/data_providers/audio_notifier.dart'; import 'package:flutter_ics_homescreen/data/data_providers/users_notifier.dart'; @@ -61,3 +62,8 @@ final dateTimeStateProvider = final hybridtateProvider = StateNotifierProvider<HybridNotifier, Hybrid>((ref) { return HybridNotifier(const Hybrid.initial()); }); + +final currentTimeProvider = + StateNotifierProvider<CurrentTimeNotifier, DateTime>((ref) { + return CurrentTimeNotifier(); +}); diff --git a/lib/data/data_providers/time_notifier.dart b/lib/data/data_providers/time_notifier.dart new file mode 100644 index 0000000..9737b2b --- /dev/null +++ b/lib/data/data_providers/time_notifier.dart @@ -0,0 +1,24 @@ +import 'dart:async'; + +import 'package:flutter_ics_homescreen/export.dart'; + +class CurrentTimeNotifier extends StateNotifier<DateTime> { + CurrentTimeNotifier() : super(DateTime.now()) { + if (!_hasInitialized) { + _initializeTimer(); + _hasInitialized = true; + } + } + + bool _hasInitialized = false; + + void _initializeTimer() { + Timer.periodic(const Duration(seconds: 1), (timer) { + state = state.add(const Duration(seconds: 1)); + }); + } + + void setCurrentTime(DateTime newTime) { + state = newTime; + } +} diff --git a/lib/main.dart b/lib/main.dart index 3b896fc..a7a0a29 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,7 +5,7 @@ import 'export.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); runApp(DevicePreview( - enabled: false, + enabled: true, tools: const [ ...DevicePreview.defaultTools, ], diff --git a/lib/presentation/common_widget/custom_top_bar.dart b/lib/presentation/common_widget/custom_top_bar.dart index c268f53..900f8be 100644 --- a/lib/presentation/common_widget/custom_top_bar.dart +++ b/lib/presentation/common_widget/custom_top_bar.dart @@ -19,12 +19,8 @@ class CustomTopBarState extends ConsumerState<CustomTopBar> { final singnalsConnection = ref.watch(signalsProvider.select((sinals) => sinals)); final user = ref.watch(usersProvider.select((user) => user)); - final time2 = - ref.watch(dateTimeStateProvider.select((dateTime) => dateTime)); - - DateFormat dateFormat = DateFormat('HH:mm'); - //var time = dateFormat.format(DateTime.now()); - var time = time2.time; + DateFormat dateFormat = DateFormat('hh:mm a'); + final currentime = ref.watch(currentTimeProvider); return AppBar( elevation: 0, @@ -41,7 +37,7 @@ class CustomTopBarState extends ConsumerState<CustomTopBar> { children: [ RichText( text: TextSpan( - text: '$time ', + text: dateFormat.format(currentime), style: const TextStyle(color: Colors.white, fontSize: 26), children: <InlineSpan>[ const WidgetSpan( diff --git a/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart b/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart index 00f1181..c373bd8 100644 --- a/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart +++ b/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart @@ -151,13 +151,14 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls> highlightColor: Colors.transparent, customBorder: const CircleBorder(), onTap: () { - _isPlaying ? null : _controller.isActive = true; setState(() { if (controlProgress >= 0.80) { controlProgress = 0.0; isMainACSelected = false; + _isPlaying = false; animationController.reverse(); } else { + _isPlaying ? null : _controller.isActive = true; isMainACSelected = true; _controller.isActive = true; _isPlaying = true; diff --git a/lib/presentation/screens/media_player/media_content.dart b/lib/presentation/screens/media_player/media_content.dart index 9a0ce19..0625c9c 100644 --- a/lib/presentation/screens/media_player/media_content.dart +++ b/lib/presentation/screens/media_player/media_content.dart @@ -22,10 +22,6 @@ class _MediaPlayerState extends State<MediaPlayer> { PlayListModel(songName: "Hey Ya!", albumName: "Outkast"), PlayListModel(songName: "One, Two, Step", albumName: "Ciara, Missy Elliot"), PlayListModel(songName: "Don’t Trust Me", albumName: "3OH!3"), - PlayListModel(songName: "Feel Good Inc.", albumName: "Gorillaz"), - PlayListModel(songName: "Feel Good Inc.", albumName: "Gorillaz"), - PlayListModel(songName: "Feel Good Inc.", albumName: "Gorillaz"), - PlayListModel(songName: "Feel Good Inc.", albumName: "Gorillaz"), ]; String selectedPlayListSongName = "Feel Good Inc."; @@ -33,29 +29,29 @@ class _MediaPlayerState extends State<MediaPlayer> { Widget build(BuildContext context) { double albumArtSize = 460; return Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - // const PlayerNavigation(), - SegmentedButtons( - navItems: navItems, - selectedNav: selectedNav, - ), - const SizedBox( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + // const PlayerNavigation(), + SegmentedButtons( + navItems: navItems, + selectedNav: selectedNav, + ), + const SizedBox( height: 32, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - "assets/AlbumArtMedia.png", - width: albumArtSize, - height: albumArtSize, - ) - ], - ), - const SizedBox( + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/AlbumArtMedia.png", + width: albumArtSize, + height: albumArtSize, + ) + ], + ), + const SizedBox( height: 40, - ), + ), Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -75,7 +71,7 @@ class _MediaPlayerState extends State<MediaPlayer> { type: "media", ), ], - ) + ) ], ); } diff --git a/lib/presentation/screens/media_player/media_player.dart b/lib/presentation/screens/media_player/media_player.dart index 9ec31e2..3126ac1 100644 --- a/lib/presentation/screens/media_player/media_player.dart +++ b/lib/presentation/screens/media_player/media_player.dart @@ -79,7 +79,7 @@ class _MediaPlayerBackgroundState extends State<MediaPlayerBackground> { }, ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 144), + padding: const EdgeInsets.symmetric(horizontal: 80), child: SingleChildScrollView( child: selectedNav == "My Media" ? const MediaPlayer() @@ -88,10 +88,11 @@ class _MediaPlayerBackgroundState extends State<MediaPlayerBackground> { : Container(), ), ), - const Padding( - padding: EdgeInsets.symmetric(horizontal: 144, vertical: 23.5), - child: CustomVolumeSlider(), - ), + if (selectedNav == "My Media" || selectedNav == "FM") + const Padding( + padding: EdgeInsets.symmetric(horizontal: 144, vertical: 23.5), + child: CustomVolumeSlider(), + ), ], ), ); diff --git a/lib/presentation/screens/media_player/play_list_table.dart b/lib/presentation/screens/media_player/play_list_table.dart index b17cfca..e5c1292 100644 --- a/lib/presentation/screens/media_player/play_list_table.dart +++ b/lib/presentation/screens/media_player/play_list_table.dart @@ -1,3 +1,4 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter_ics_homescreen/core/utils/helpers.dart'; import 'package:flutter_ics_homescreen/export.dart'; @@ -117,8 +118,9 @@ class _PlayListTableState extends State<PlayListTable> { children: [ Expanded( flex: 6, - child: Text( + child: AutoSizeText( index.songName, + maxLines: 1, style: TextStyle( color: Colors.white, fontSize: 40, diff --git a/lib/presentation/screens/media_player/segmented_buttons.dart b/lib/presentation/screens/media_player/segmented_buttons.dart index e649be3..5cc1d87 100644 --- a/lib/presentation/screens/media_player/segmented_buttons.dart +++ b/lib/presentation/screens/media_player/segmented_buttons.dart @@ -43,8 +43,6 @@ class _SegmentedButtonsState extends State<SegmentedButtons> { child: Row( children: navItems .map((e) => Container( - padding: const EdgeInsets.symmetric( - vertical: 24, horizontal: 32), decoration: BoxDecoration( borderRadius: selectedNav == e ? BorderRadius.circular(40) @@ -53,23 +51,30 @@ class _SegmentedButtonsState extends State<SegmentedButtons> { ? AGLDemoColors.backgroundInsetColor : null, ), - child: InkWell( - borderRadius: BorderRadius.circular(40), - onTap: () { - setState(() { - selectedNav = e; - }); - }, - child: Text( - e, - style: TextStyle( - color: selectedNav == e - ? Colors.white - : AGLDemoColors.periwinkleColor, - fontSize: 26, - fontWeight: selectedNav == e - ? FontWeight.w700 - : FontWeight.w500), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(40), + onTap: () { + setState(() { + selectedNav = e; + }); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 24, horizontal: 32), + child: Text( + e, + style: TextStyle( + color: selectedNav == e + ? Colors.white + : AGLDemoColors.periwinkleColor, + fontSize: 26, + fontWeight: selectedNav == e + ? FontWeight.w700 + : FontWeight.w500), + ), + ), ), ), )) diff --git a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart b/lib/presentation/screens/media_player/widgets/media_volume_bar.dart index f8d58e6..2b063b4 100644 --- a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart +++ b/lib/presentation/screens/media_player/widgets/media_volume_bar.dart @@ -53,21 +53,39 @@ class CustomVolumeSliderState extends ConsumerState<CustomVolumeSlider> { child: Row( children: [ Padding( - padding: const EdgeInsets.only(left: 10.0), - child: SizedBox( - width: 50, - child: IconButton( - padding: EdgeInsets.zero, - onPressed: () { + padding: const EdgeInsets.only(left: 20), + child: Material( + color: Colors.transparent, + child: InkWell( + customBorder: const CircleBorder(), + onTap: () { _dercrease(); }, - icon: const Icon( - CustomIcons.vol_min, - color: AGLDemoColors.periwinkleColor, - size: 48, - )), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon( + CustomIcons.vol_min, + color: AGLDemoColors.periwinkleColor, + size: 60, + ))), ), ), + // Padding( + // padding: const EdgeInsets.only(left: 10.0), + // child: SizedBox( + // width: 50, + // child: IconButton( + // padding: EdgeInsets.zero, + // onPressed: () { + // _dercrease(); + // }, + // icon: const Icon( + // CustomIcons.vol_min, + // color: AGLDemoColors.periwinkleColor, + // size: 48, + // )), + // ), + // ), Expanded( child: SliderTheme( data: SliderThemeData( @@ -93,21 +111,39 @@ class CustomVolumeSliderState extends ConsumerState<CustomVolumeSlider> { ), ), Padding( - padding: const EdgeInsets.only(right: 10.0), - child: SizedBox( - width: 60, - child: IconButton( - padding: EdgeInsets.zero, - onPressed: () { + padding: const EdgeInsets.only(right: 20), + child: Material( + color: Colors.transparent, + child: InkWell( + customBorder: const CircleBorder(), + onTap: () { _increase(); }, - icon: const Icon( - CustomIcons.vol_max, - color: AGLDemoColors.periwinkleColor, - size: 48, - )), + child: const Padding( + padding: EdgeInsets.all(8.0), + child: Icon( + CustomIcons.vol_max, + color: AGLDemoColors.periwinkleColor, + size: 60, + ))), ), ), + // Padding( + // padding: const EdgeInsets.only(right: 10.0), + // child: SizedBox( + // width: 60, + // child: IconButton( + // padding: EdgeInsets.zero, + // onPressed: () { + // _increase(); + // }, + // icon: const Icon( + // CustomIcons.vol_max, + // color: AGLDemoColors.periwinkleColor, + // size: 48, + // )), + // ), + // ), ], ), ), diff --git a/lib/presentation/screens/settings/settings_screens/audio_settings/widget/audio_content.dart b/lib/presentation/screens/settings/settings_screens/audio_settings/widget/audio_content.dart index 8fb0437..a08796d 100644 --- a/lib/presentation/screens/settings/settings_screens/audio_settings/widget/audio_content.dart +++ b/lib/presentation/screens/settings/settings_screens/audio_settings/widget/audio_content.dart @@ -17,7 +17,13 @@ class AudioContent extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ CustomTrebleSlider(), + SizedBox( + height: 120, + ), CustomBassSlider(), + SizedBox( + height: 120, + ), CustomRearFrontSlider(), ], ), @@ -30,9 +36,8 @@ class AudioContent extends ConsumerWidget { text: 'Reset to Default', onTap: () { ref.read(audioStateProvider.notifier).resetToDefaults(); - }, - ), - + }, + ), ), ], ), diff --git a/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart b/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart index 2365ecc..c9a3abf 100644 --- a/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/date_time/date_time_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter_ics_homescreen/export.dart'; +import 'package:intl/intl.dart'; class DateTimePage extends ConsumerWidget { const DateTimePage({super.key}); @@ -7,6 +8,8 @@ class DateTimePage extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final dateTime = ref.watch(dateTimeStateProvider.select((val) => val)); + DateFormat dateFormat = DateFormat('hh:mm a'); + final currentime = ref.watch(currentTimeProvider); return Scaffold( body: Column( @@ -36,7 +39,7 @@ class DateTimePage extends ConsumerWidget { UnitsTile( image: "assets/Time.svg", title: 'Time', - unitName: dateTime.time, + unitName: dateFormat.format(currentime), hasSwich: true, voidCallback: () { context diff --git a/lib/presentation/screens/settings/settings_screens/date_time/time/time_screen.dart b/lib/presentation/screens/settings/settings_screens/date_time/time/time_screen.dart index 61131b5..de8adb4 100644 --- a/lib/presentation/screens/settings/settings_screens/date_time/time/time_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/date_time/time/time_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter_ics_homescreen/export.dart'; import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; +import 'package:new_virtual_keyboard/virtual_keyboard.dart'; class TimePage extends ConsumerWidget { const TimePage({super.key}); @@ -45,9 +46,22 @@ class TimeScreenWidgetState extends ConsumerState<TimeScreenWidget> { onPressed({required String type}) { if (type == "confirm") { - ref.read(dateTimeStateProvider.notifier).setTime( - "${hourController.text}:${minuteController.text} $selectedMeridien"); - context.flow<AppState>().update((state) => AppState.dateTime); + if (hourController.text.isNotEmpty && minuteController.text.isNotEmpty) { + String input = + '${hourController.text}:${minuteController.text} $selectedMeridien'; + DateTime selectedeDatetime = DateFormat.jm().parse(input); + + ref + .read(currentTimeProvider.notifier) + .setCurrentTime(selectedeDatetime); + + // ref.read(dateTimeStateProvider.notifier).setTime( + // "${hourController.text}:${minuteController.text} $selectedMeridien"); + context.flow<AppState>().update((state) => AppState.dateTime); + } else { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text("Time can't be empty!"))); + } } else if (type == "cancel") { context.flow<AppState>().update((state) => AppState.dateTime); } @@ -55,10 +69,9 @@ class TimeScreenWidgetState extends ConsumerState<TimeScreenWidget> { @override void initState() { - String time = ref.read(dateTimeStateProvider).time; - if (time == "hh:mm a") { - time = DateFormat('hh:mm a').format(DateTime.now()); - } + DateTime currentTime = ref.read(currentTimeProvider); + String time = DateFormat('hh:mm a').format(currentTime); + List<String> split = time.split(":"); selectedTimeHour = int.parse(split[0]); List<String> splitMeridian = split[1].split(" "); @@ -388,6 +401,74 @@ class _TimeTextFieldState extends State<TimeTextField> { return KeyEventResult.ignored; } + void showKeyboard() { + var ctx = homeScaffoldKey.currentContext; + showModalBottomSheet( + elevation: 0.0, + backgroundColor: Colors.transparent, + barrierColor: Colors.transparent, + context: ctx!, + builder: (ctx) { + return Container( + height: 479, + width: 1080, + decoration: const BoxDecoration( + color: AGLDemoColors.resolutionBlueColor, + border: Border( + top: BorderSide( + color: Color(0xFF295EF7), + width: 1, + )), + ), + child: VirtualKeyboard( + height: 478, + textColor: AGLDemoColors.periwinkleColor, + fontSize: 40, + // [A-Z, 0-9] + type: VirtualKeyboardType.Numeric, + // Callback for key press event + onKeyPress: (key) { + _onKeyPress(key); + }, + ), + ); + }, + ); + } + + _onKeyPress(VirtualKeyboardKey key) { + String text = controller.text; + + if (key.keyType == VirtualKeyboardKeyType.String) { + if (key.text != ".") { + text = text + key.text!; + int value = int.parse(text); + + if (widget.type == "hour") { + if (value > 11) { + text = "12"; + } + } else if (widget.type == "minute") { + if (value > 58) { + text = "59"; + } + } + } + } else if (key.keyType == VirtualKeyboardKeyType.Action) { + switch (key.action) { + case VirtualKeyboardKeyAction.Backspace: + if (text.isEmpty) return; + text = text.substring(0, text.length - 1); + break; + // case VirtualKeyboardKeyAction.Return: + // text = '$text\n'; + // break; + default: + } + } + controller.text = text; + } + @override Widget build(BuildContext context) { return SizedBox( @@ -397,6 +478,9 @@ class _TimeTextFieldState extends State<TimeTextField> { return onKeyBoardEvent(event); }), child: TextField( + onTap: () { + showKeyboard(); + }, style: const TextStyle(color: Colors.white, fontSize: 40), decoration: InputDecoration( contentPadding: const EdgeInsets.symmetric(vertical: 23), diff --git a/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart b/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart index 916b1b6..35225b8 100644 --- a/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart +++ b/lib/presentation/screens/settings/settings_screens/wired/wired_screen.dart @@ -1,4 +1,6 @@ +import 'package:flutter_ics_homescreen/core/utils/helpers.dart'; import 'package:flutter_ics_homescreen/export.dart'; +import 'package:get_ip_address/get_ip_address.dart'; class WiredPage extends ConsumerWidget { const WiredPage({super.key}); @@ -6,71 +8,142 @@ class WiredPage extends ConsumerWidget { static Page<void> page() => const MaterialPage<void>(child: WiredPage()); @override Widget build(BuildContext context, WidgetRef ref) { - return Scaffold( - body: Column( - children: [ - CommonTitle( - title: 'Wired', - hasBackButton: true, - onPressed: () { - context.flow<AppState>().update((state) => AppState.settings); - }, + return const Scaffold(body: WiredScreen()); + } +} + +class WiredScreen extends StatefulWidget { + const WiredScreen({super.key}); + + @override + State<WiredScreen> createState() => _WiredScreenState(); +} + +class _WiredScreenState extends State<WiredScreen> { + String deviceIP = "192.168.234.120"; + @override + void initState() { + super.initState(); + getIPAddress(); + } + + getIPAddress() async { + try { + /// Initialize Ip Address + var ipAddress = IpAddress(type: RequestType.text); + + /// Get the IpAddress based on requestType. + dynamic data = await ipAddress.getIpAddress(); + setState(() { + deviceIP = data.toString(); + }); + } on IpAddressException catch (exception) { + /// Handle the exception. + print(exception.message); + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + CommonTitle( + title: 'Wired', + hasBackButton: true, + onPressed: () { + context.flow<AppState>().update((state) => AppState.settings); + }, + ), + Container( + margin: const EdgeInsets.symmetric(horizontal: 120, vertical: 40), + padding: const EdgeInsets.symmetric(vertical: 17, horizontal: 24), + height: 140, + alignment: Alignment.center, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + stops: const [ + 0, + 0.01, + 0.8 + ], + colors: <Color>[ + Colors.white, + AGLDemoColors.neonBlueColor, + AGLDemoColors.neonBlueColor.withOpacity(0.15) + ]), ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 50, horizontal: 80), - child: Container( - height: 130, - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - stops: [ - 0, - 0.01, - 0.8 + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // const SizedBox( + // width: 20, + // ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const Text( + 'hernet_0090451v407b_cable', + style: TextStyle(color: Colors.white, fontSize: 40), + ), + Text( + 'connected, $deviceIP', + style: + const TextStyle(color: Colors.white, fontSize: 26), + ), ], - colors: <Color>[ - Colors.white, - Colors.blue, - Color.fromARGB(16, 41, 98, 255) - ]), - ), - child: ListTile( - contentPadding: - const EdgeInsets.symmetric(vertical: 41, horizontal: 24), - - title: const Text( - 'hernet_0090451v407b_cable', - style: TextStyle(color: Colors.white, fontSize: 40), - ), - subtitle: const Text( - 'connected, 192.168.234.120', - style: TextStyle(color: Colors.white, fontSize: 26), - ), - trailing: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF1C2D92), - side: const BorderSide(color: Color(0xFF285DF4), width: 2), ), - child: const Padding( - padding: - EdgeInsets.symmetric(vertical: 15.0, horizontal: 0), - child: Text( - - 'Configure', - style: TextStyle( - color: Color(0xFFC1D8FF), - fontSize: 26, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: AGLDemoColors.buttonFillEnabledColor, + border: Border.all(color: AGLDemoColors.neonBlueColor), + boxShadow: [Helpers.boxDropShadowRegular]), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: () {}, + borderRadius: BorderRadius.circular(4), + child: const Padding( + padding: + EdgeInsets.symmetric(vertical: 30, horizontal: 40), + child: Text( + "Configure", + style: TextStyle( + color: AGLDemoColors.periwinkleColor, + fontSize: 26), + ), ), ), ), - onPressed: () {}, ), - ), - ), - ), - ], - ), + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // backgroundColor: const Color(0xFF1C2D92), + // side: + // const BorderSide(color: Color(0xFF285DF4), width: 2), + // ), + // child: const Padding( + // padding: + // EdgeInsets.symmetric(vertical: 15.0, horizontal: 0), + // child: Text( + // 'Configure', + // style: TextStyle( + // color: Color(0xFFC1D8FF), + // fontSize: 26, + // ), + // ), + // ), + // onPressed: () {}, + // ), + ]), + ), + ], ); } } diff --git a/lib/presentation/screens/weather/hourly_forecast.dart b/lib/presentation/screens/weather/hourly_forecast.dart index aed8a6c..f6170ec 100644 --- a/lib/presentation/screens/weather/hourly_forecast.dart +++ b/lib/presentation/screens/weather/hourly_forecast.dart @@ -8,24 +8,16 @@ class HourlyForecast extends StatefulWidget { } class _HourlyForecastState extends State<HourlyForecast> { - String selectedForescastTime = "13:00"; + String selectedForescastTime = "01:00 pm"; List<ForecastModel> foreCastList = [ ForecastModel( - time: "13:00", image: "assets/weatherStat.svg", weather: "29.1°"), + time: "01:00 pm", image: "assets/weatherStat.svg", weather: "29.1°"), ForecastModel( - time: "14:00", image: "assets/weatherStat.svg", weather: "28.1°"), + time: "02:00 pm", image: "assets/weatherStat.svg", weather: "28.1°"), ForecastModel( - time: "15:00", image: "assets/weatherStat.svg", weather: "27.1°"), + time: "03:00 pm", image: "assets/weatherStat.svg", weather: "27.1°"), ForecastModel( - time: "16:00", image: "assets/weatherStat.svg", weather: "29.1°"), - ForecastModel( - time: "13:00", image: "assets/weatherStat.svg", weather: "29.1°"), - ForecastModel( - time: "14:00", image: "assets/weatherStat.svg", weather: "28.1°"), - ForecastModel( - time: "15:00", image: "assets/weatherStat.svg", weather: "27.1°"), - ForecastModel( - time: "16:00", image: "assets/weatherStat.svg", weather: "29.1°"), + time: "04:00 pm", image: "assets/weatherStat.svg", weather: "29.1°"), ]; @override Widget build(BuildContext context) { diff --git a/lib/presentation/screens/weather/weather.dart b/lib/presentation/screens/weather/weather.dart index 7231700..d86bd13 100644 --- a/lib/presentation/screens/weather/weather.dart +++ b/lib/presentation/screens/weather/weather.dart @@ -7,6 +7,8 @@ class WeatherPage extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { double weatherIconSize = MediaQuery.sizeOf(context).width * 0.278; + final unit = + ref.watch(unitStateProvider.select((unit) => unit.temperatureUnit)); return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -58,7 +60,7 @@ class WeatherPage extends ConsumerWidget { height: 60, ), Text( - "28.3°C", + "28.3°${unit == TemperatureUnit.celsius ? "C" : "F"}", style: GoogleFonts.brunoAce( color: Colors.white, fontSize: 128), ), diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 09ccbe9..f3a038b 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -39,4 +39,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/pubspec.lock b/pubspec.lock index f78814f..896d1bf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -25,6 +25,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" boolean_selector: dependency: transitive description: @@ -213,6 +221,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.1" + get_ip_address: + dependency: "direct main" + description: + name: get_ip_address + sha256: "0e973f1ad61bc4b0b1d99abc2c023d91d1ddb09709f5546f6972ace067c8576d" + url: "https://pub.dev" + source: hosted + version: "0.0.6" google_fonts: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 6aa9639..fc1f25f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,8 @@ dependencies: device_preview: ^1.1.0 rive: ^0.12.3 new_virtual_keyboard: ^0.1.4 + auto_size_text: ^3.0.0 + get_ip_address: ^0.0.6 dev_dependencies: |