From d4a6bb2cd7987d74bc60ea0624869cfb155e06a7 Mon Sep 17 00:00:00 2001 From: Lucas Delanier Date: Wed, 2 Aug 2023 14:36:03 +0200 Subject: [PATCH] new dot appearance schema --- .idea/libraries/Dart_Packages.xml | 48 +++++++ .../lib/screens/detail_post_screen.dart | 131 ++++-------------- Sources/justMUSIC/pubspec.lock | 48 +++++++ Sources/justMUSIC/pubspec.yaml | 1 + 4 files changed, 122 insertions(+), 106 deletions(-) diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index db02f0e..2328905 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -338,6 +338,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -906,6 +948,12 @@ + + + + + + diff --git a/Sources/justMUSIC/lib/screens/detail_post_screen.dart b/Sources/justMUSIC/lib/screens/detail_post_screen.dart index 700e061..92be9b3 100644 --- a/Sources/justMUSIC/lib/screens/detail_post_screen.dart +++ b/Sources/justMUSIC/lib/screens/detail_post_screen.dart @@ -1,5 +1,8 @@ +import 'dart:async'; + import 'package:flutter/Material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -23,6 +26,9 @@ class DetailPostScreen extends StatefulWidget { } class _DetailPostScreenState extends State { + TextEditingController _textController = TextEditingController(); + late FocusNode myFocusNode; + late StreamSubscription keyboardSubscription; Future resetFullScreen() async { await SystemChannels.platform.invokeMethod( 'SystemChrome.restoreSystemUIOverlays', @@ -41,6 +47,7 @@ class _DetailPostScreenState extends State { @override void dispose() { MyApp.audioPlayer.release(); + myFocusNode.dispose(); super.dispose(); } @@ -48,114 +55,19 @@ class _DetailPostScreenState extends State { void initState() { print("post: ${widget.post.date.toString()}"); print("ajrd: ${DateTime.now().toString()}"); + myFocusNode = FocusNode(); + var keyboardVisibilityController = KeyboardVisibilityController(); + print('Keyboard visibility direct query: ${keyboardVisibilityController.isVisible}'); + super.initState(); + + keyboardSubscription = keyboardVisibilityController.onChange.listen((bool visible) { + if (!visible) { + myFocusNode.unfocus(); + } + }); } - /*void test() { - return Column( - children: [ - Align( - child: Container( - width: 60, - height: 5, - decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.circular(20))), - ), - const SizedBox( - height: 20, - ), - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.only(topRight: Radius.circular(15), topLeft: Radius.circular(15)), - child: Padding( - padding: EdgeInsets.only(left: defaultPadding, right: defaultPadding), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast), - child: Wrap( - // to apply margin in the main axis of the wrap - runSpacing: 10, - children: [ - Container(height: 5), - Align( - child: RichText( - text: TextSpan( - text: "3", - style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w600), - children: [ - TextSpan( - text: " commentaires", - style: GoogleFonts.plusJakartaSans(color: Colors.white, fontWeight: FontWeight.w300), - ) - ])), - ), - SizedBox(height: 20), - CommentComponent(), - CommentComponent(), - CommentComponent(), - Container(height: 10), - ], - ), - ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), - child: Container( - height: 70, - width: double.infinity, - decoration: - BoxDecoration(border: Border(top: BorderSide(color: grayColor, width: 2)), color: textFieldMessage), - child: Center( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Row( - children: [ - ClipOval( - child: SizedBox.fromSize( - // Image radius - child: const Image( - image: AssetImage("assets/images/exemple_profile.png"), - width: 45, - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: TextField( - keyboardAppearance: Brightness.dark, - cursorColor: primaryColor, - keyboardType: TextInputType.emailAddress, - style: GoogleFonts.plusJakartaSans(color: Colors.white), - decoration: InputDecoration( - suffixIcon: Icon( - Icons.send, - color: grayText, - size: 20, - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(width: 1, color: grayText), - borderRadius: BorderRadius.all(Radius.circular(100))), - contentPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), - fillColor: bgModal, - filled: true, - focusColor: Color.fromRGBO(255, 255, 255, 0.30), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(width: 1, color: grayText), - borderRadius: BorderRadius.all(Radius.circular(100))), - hintText: 'Ajoutez une réponse...', - hintStyle: GoogleFonts.plusJakartaSans(color: grayText)), - ), - ) - ], - ), - ), - )), - ), - ], - ); - }*/ final ScrollController _scrollController = ScrollController(); @override @@ -364,7 +276,12 @@ class _DetailPostScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SvgPicture.asset("assets/images/heart.svg", semanticsLabel: 'Like Logo'), - SvgPicture.asset("assets/images/chat.svg", semanticsLabel: 'Chat Logo'), + GestureDetector( + onTap: () { + myFocusNode.requestFocus(); + }, + child: SvgPicture.asset("assets/images/chat.svg", + semanticsLabel: 'Chat Logo')), SvgPicture.asset("assets/images/add.svg", semanticsLabel: 'Add playlist Logo'), SvgPicture.asset("assets/images/save.svg", semanticsLabel: 'Save Logo'), @@ -490,6 +407,8 @@ class _DetailPostScreenState extends State { Expanded( child: TextField( keyboardAppearance: Brightness.dark, + controller: _textController, + focusNode: myFocusNode, cursorColor: primaryColor, keyboardType: TextInputType.emailAddress, style: GoogleFonts.plusJakartaSans(color: Colors.white), diff --git a/Sources/justMUSIC/pubspec.lock b/Sources/justMUSIC/pubspec.lock index a63a241..30973dd 100644 --- a/Sources/justMUSIC/pubspec.lock +++ b/Sources/justMUSIC/pubspec.lock @@ -382,6 +382,54 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + flutter_keyboard_visibility: + dependency: "direct main" + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_lints: dependency: "direct dev" description: diff --git a/Sources/justMUSIC/pubspec.yaml b/Sources/justMUSIC/pubspec.yaml index bc11957..d56b47b 100644 --- a/Sources/justMUSIC/pubspec.yaml +++ b/Sources/justMUSIC/pubspec.yaml @@ -71,6 +71,7 @@ dependencies: custom_refresh_indicator: ^2.2.1 animations: ^2.0.7 flutter_svg: ^2.0.7 + flutter_keyboard_visibility: ^5.4.1 dev_dependencies: flutter_test: