parent
225203ca28
commit
8d96fe5b18
@ -0,0 +1,102 @@
|
|||||||
|
import 'package:flutter/Material.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import '../model/User.dart';
|
||||||
|
import '../values/constants.dart';
|
||||||
|
|
||||||
|
class ProfileListComponent extends StatefulWidget {
|
||||||
|
final User user;
|
||||||
|
const ProfileListComponent({super.key, required this.user});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ProfileListComponent> createState() => _ProfileListComponentState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ProfileListComponentState extends State<ProfileListComponent> {
|
||||||
|
bool clicked = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
ClipOval(
|
||||||
|
child: FadeInImage.assetNetwork(
|
||||||
|
height: 50,
|
||||||
|
width: 50,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
placeholder: "assets/images/loadingPlaceholder.gif",
|
||||||
|
image: widget.user.pp)),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 10,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ScrollConfiguration(
|
||||||
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||||
|
child: Text(
|
||||||
|
widget.user.pseudo,
|
||||||
|
style: GoogleFonts.plusJakartaSans(fontSize: 16, color: Colors.white, fontWeight: FontWeight.w700),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ScrollConfiguration(
|
||||||
|
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||||
|
child: Text(
|
||||||
|
widget.user.id,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: GoogleFonts.plusJakartaSans(color: Colors.grey, fontWeight: FontWeight.w400),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
clicked
|
||||||
|
? Material(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
color: selectedButton,
|
||||||
|
child: InkWell(
|
||||||
|
splashColor: Colors.white.withOpacity(0.3),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
clicked = !clicked;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(28, 7, 28, 7),
|
||||||
|
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||||
|
child: Center(
|
||||||
|
child: Text("Ajouté",
|
||||||
|
style: GoogleFonts.plusJakartaSans(
|
||||||
|
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
: Material(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||||
|
color: primaryColor,
|
||||||
|
child: InkWell(
|
||||||
|
splashColor: Colors.white.withOpacity(0.3),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
clicked = !clicked;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.fromLTRB(25, 7, 25, 7),
|
||||||
|
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(7))),
|
||||||
|
child: Center(
|
||||||
|
child: Text("Ajouter",
|
||||||
|
style: GoogleFonts.plusJakartaSans(
|
||||||
|
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 13)),
|
||||||
|
),
|
||||||
|
))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,234 @@
|
|||||||
|
import 'package:flutter/Material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:justmusic/values/constants.dart';
|
||||||
|
|
||||||
|
import '../components/profile_list_component.dart';
|
||||||
|
import '../model/User.dart';
|
||||||
|
|
||||||
|
class AddFriendScreen extends StatefulWidget {
|
||||||
|
const AddFriendScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<AddFriendScreen> createState() => _AddFriendScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddFriendScreenState extends State<AddFriendScreen> {
|
||||||
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
final TextEditingController _textEditingController = TextEditingController();
|
||||||
|
|
||||||
|
List<User> fakeList = [
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2UYSIpWSnX4gJhZJzaN4q.jpg?alt=media&token=39baf86a-4d19-4534-b777-1a4feca67359",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
User(
|
||||||
|
"&",
|
||||||
|
"_pseudo",
|
||||||
|
"_country",
|
||||||
|
"_mail",
|
||||||
|
"https://firebasestorage.googleapis.com/v0/b/justmusic-435d5.appspot.com/o/RUiGpZ8AzCQPqiVJKwuQeIqiC4B2bafPGRGLh2La72LkmQst.jpg?alt=media&token=ac1916f0-e08d-43bd-977a-2c2d94182609",
|
||||||
|
1,
|
||||||
|
12,
|
||||||
|
23, []),
|
||||||
|
];
|
||||||
|
|
||||||
|
Future<void> resetFullScreen() async {
|
||||||
|
await SystemChannels.platform.invokeMethod<void>(
|
||||||
|
'SystemChrome.restoreSystemUIOverlays',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size(double.infinity, 58),
|
||||||
|
child: Container(
|
||||||
|
height: double.infinity,
|
||||||
|
color: bgAppBar,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: defaultPadding),
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
child: Text(
|
||||||
|
"Ajouter des amis",
|
||||||
|
style:
|
||||||
|
GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: Transform(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
transform: Matrix4.rotationY(3.14159265),
|
||||||
|
child: Container(
|
||||||
|
height: 25,
|
||||||
|
width: 25,
|
||||||
|
child: const Icon(Icons.arrow_back_ios, color: Colors.white, size: 15)),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
color: bgColor,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20, left: 20, right: 20, top: 20),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: TextField(
|
||||||
|
autofocus: false,
|
||||||
|
controller: _textEditingController,
|
||||||
|
keyboardAppearance: Brightness.dark,
|
||||||
|
onEditingComplete: resetFullScreen,
|
||||||
|
onSubmitted: (value) async {
|
||||||
|
if (_textEditingController.text.isEmpty) {
|
||||||
|
print("search");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cursorColor: Colors.white,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
style: GoogleFonts.plusJakartaSans(color: grayText),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
prefixIcon: const Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: grayColor,
|
||||||
|
),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(width: 1, color: grayColor),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.only(top: 0, bottom: 0, left: defaultPadding, right: defaultPadding),
|
||||||
|
fillColor: searchBarColor,
|
||||||
|
filled: true,
|
||||||
|
focusColor: grayText,
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(width: 1, color: grayColor),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||||
|
hintText: 'Chercher un ami',
|
||||||
|
hintStyle: GoogleFonts.plusJakartaSans(color: grayHint)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: ScrollConfiguration(
|
||||||
|
behavior: const ScrollBehavior().copyWith(scrollbars: true),
|
||||||
|
child: ListView.builder(
|
||||||
|
physics: const BouncingScrollPhysics(decelerationRate: ScrollDecelerationRate.fast),
|
||||||
|
itemCount: fakeList.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return InkWell(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(20, 0, 20, 20),
|
||||||
|
child: ProfileListComponent(user: fakeList[index])),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue