|
|
@ -4,6 +4,7 @@ import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import 'package:justmusic/values/constants.dart';
|
|
|
|
import 'package:justmusic/values/constants.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../components/profile_list_component.dart';
|
|
|
|
import '../components/profile_list_component.dart';
|
|
|
|
|
|
|
|
import '../main.dart';
|
|
|
|
import '../model/User.dart';
|
|
|
|
import '../model/User.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class AddFriendScreen extends StatefulWidget {
|
|
|
|
class AddFriendScreen extends StatefulWidget {
|
|
|
@ -17,116 +18,14 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
final ScrollController _scrollController = ScrollController();
|
|
|
|
final ScrollController _scrollController = ScrollController();
|
|
|
|
final TextEditingController _textEditingController = TextEditingController();
|
|
|
|
final TextEditingController _textEditingController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
List<User> fakeList = [
|
|
|
|
List<User> _listUsers = [];
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
Future<void> updateList(String value) async {
|
|
|
|
"_pseudo",
|
|
|
|
var newlistUsers = await MyApp.userViewModel.getUsersByUniqueId(value);
|
|
|
|
"_pseudo",
|
|
|
|
setState(() {
|
|
|
|
"_mail",
|
|
|
|
_listUsers = newlistUsers;
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2UYSIpWSnX4gJhZJzaN4q.jpg?alt=media&token=39baf86a-4d19-4534-b777-1a4feca67359",
|
|
|
|
});
|
|
|
|
[],
|
|
|
|
}
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
User(
|
|
|
|
|
|
|
|
"&",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_pseudo",
|
|
|
|
|
|
|
|
"_mail",
|
|
|
|
|
|
|
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
|
|
|
|
|
|
|
[],
|
|
|
|
|
|
|
|
12,
|
|
|
|
|
|
|
|
[]),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> resetFullScreen() async {
|
|
|
|
Future<void> resetFullScreen() async {
|
|
|
|
await SystemChannels.platform.invokeMethod<void>(
|
|
|
|
await SystemChannels.platform.invokeMethod<void>(
|
|
|
@ -150,10 +49,8 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
Align(
|
|
|
|
Align(
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
"Ajouter des amis",
|
|
|
|
"Ajouter des amis",
|
|
|
|
style: GoogleFonts.plusJakartaSans(
|
|
|
|
style:
|
|
|
|
color: Colors.white,
|
|
|
|
GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
GestureDetector(
|
|
|
@ -169,8 +66,7 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
width: 30,
|
|
|
|
width: 30,
|
|
|
|
child: const Image(
|
|
|
|
child: const Image(
|
|
|
|
image:
|
|
|
|
image: AssetImage("assets/images/return_icon.png"),
|
|
|
|
AssetImage("assets/images/return_icon.png"),
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
))),
|
|
|
|
))),
|
|
|
@ -184,8 +80,7 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
padding: const EdgeInsets.only(bottom: 20, left: 20, right: 20, top: 20),
|
|
|
|
bottom: 20, left: 20, right: 20, top: 20),
|
|
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
|
height: 40,
|
|
|
|
height: 40,
|
|
|
|
child: TextField(
|
|
|
|
child: TextField(
|
|
|
@ -194,8 +89,8 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
keyboardAppearance: Brightness.dark,
|
|
|
|
keyboardAppearance: Brightness.dark,
|
|
|
|
onEditingComplete: resetFullScreen,
|
|
|
|
onEditingComplete: resetFullScreen,
|
|
|
|
onSubmitted: (value) async {
|
|
|
|
onSubmitted: (value) async {
|
|
|
|
if (_textEditingController.text.isEmpty) {
|
|
|
|
if (_textEditingController.text.isNotEmpty) {
|
|
|
|
print("search");
|
|
|
|
updateList(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
cursorColor: Colors.white,
|
|
|
|
cursorColor: Colors.white,
|
|
|
@ -208,40 +103,31 @@ class _AddFriendScreenState extends State<AddFriendScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
focusedBorder: const OutlineInputBorder(
|
|
|
|
focusedBorder: const OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(width: 1, color: grayColor),
|
|
|
|
borderSide: BorderSide(width: 1, color: grayColor),
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
|
|
BorderRadius.all(Radius.circular(10))),
|
|
|
|
contentPadding:
|
|
|
|
contentPadding: const EdgeInsets.only(
|
|
|
|
const EdgeInsets.only(top: 0, bottom: 0, left: defaultPadding, right: defaultPadding),
|
|
|
|
top: 0,
|
|
|
|
|
|
|
|
bottom: 0,
|
|
|
|
|
|
|
|
left: defaultPadding,
|
|
|
|
|
|
|
|
right: defaultPadding),
|
|
|
|
|
|
|
|
fillColor: searchBarColor,
|
|
|
|
fillColor: searchBarColor,
|
|
|
|
filled: true,
|
|
|
|
filled: true,
|
|
|
|
focusColor: grayText,
|
|
|
|
focusColor: grayText,
|
|
|
|
enabledBorder: const OutlineInputBorder(
|
|
|
|
enabledBorder: const OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(width: 1, color: grayColor),
|
|
|
|
borderSide: BorderSide(width: 1, color: grayColor),
|
|
|
|
borderRadius:
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
|
|
|
BorderRadius.all(Radius.circular(10))),
|
|
|
|
|
|
|
|
hintText: 'Chercher un ami',
|
|
|
|
hintText: 'Chercher un ami',
|
|
|
|
hintStyle:
|
|
|
|
hintStyle: GoogleFonts.plusJakartaSans(color: grayHint)),
|
|
|
|
GoogleFonts.plusJakartaSans(color: grayHint)),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Flexible(
|
|
|
|
Flexible(
|
|
|
|
child: ScrollConfiguration(
|
|
|
|
child: ScrollConfiguration(
|
|
|
|
behavior:
|
|
|
|
behavior: const ScrollBehavior().copyWith(scrollbars: true),
|
|
|
|
const ScrollBehavior().copyWith(scrollbars: true),
|
|
|
|
|
|
|
|
child: ListView.builder(
|
|
|
|
child: ListView.builder(
|
|
|
|
physics: const BouncingScrollPhysics(
|
|
|
|
physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
|
|
|
|
decelerationRate: ScrollDecelerationRate.fast),
|
|
|
|
itemCount: _listUsers.length,
|
|
|
|
itemCount: fakeList.length,
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return InkWell(
|
|
|
|
return InkWell(
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(20, 0, 20, 20),
|
|
|
|
padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
|
|
|
|
child: ProfileListComponent(
|
|
|
|
child: ProfileListComponent(user: _listUsers[index])),
|
|
|
|
user: fakeList[index])),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)))
|
|
|
|
)))
|
|
|
|