diff options
Diffstat (limited to 'lib/presentation/screens/settings/settings_screens')
4 files changed, 234 insertions, 69 deletions
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: () {}, + // ), + ]), + ), + ], ); } } |