commit
1c177c2279
@ -1,7 +1,9 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.justmusic">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
</manifest>
|
||||
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,146 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:ionicons/ionicons.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../values/constants.dart';
|
||||
|
||||
class PhotoPostComponent extends StatelessWidget {
|
||||
final bool empty;
|
||||
const PhotoPostComponent({Key? key, required this.empty}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return empty
|
||||
? Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: postbutton, borderRadius: BorderRadius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Icon(
|
||||
Ionicons.camera,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Prendre un selfie',
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
)
|
||||
]),
|
||||
))
|
||||
: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: fillButton, borderRadius: BorderRadius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Selfie enregistré",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Icon(
|
||||
Icons.close,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
]),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class LocationPostComponent extends StatelessWidget {
|
||||
final bool empty;
|
||||
final Tuple2<String, String>? location;
|
||||
const LocationPostComponent(
|
||||
{Key? key, required this.empty, required this.location})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return empty
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: postbutton, borderRadius: BorderRadius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
size: 15,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Ajouter un lieu',
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
])),
|
||||
)
|
||||
: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: fillButton, borderRadius: BorderRadius.circular(8)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${location?.item1}, ${location?.item2}',
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Icon(
|
||||
Icons.close,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/values/constants.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class CityListComponent extends StatelessWidget {
|
||||
final Tuple2<String, String> location;
|
||||
const CityListComponent({Key? key, required this.location}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(
|
||||
child: RichText(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: location.item2 + ", ",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 17),
|
||||
),
|
||||
TextSpan(
|
||||
text: location.item1,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 17),
|
||||
),
|
||||
])),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,113 +1,377 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/values/constants.dart';
|
||||
|
||||
class EditablePostComponent extends StatefulWidget {
|
||||
const EditablePostComponent({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<EditablePostComponent> createState() => _EditablePostComponentState();
|
||||
}
|
||||
|
||||
class _EditablePostComponentState extends State<EditablePostComponent> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: 400),
|
||||
width: double.infinity,
|
||||
color: warningBttnColor,
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 1 / 1,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
// add border
|
||||
border: Border.all(width: 3.0, color: grayColor),
|
||||
// set border radius
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
// implement image
|
||||
child: const Image(
|
||||
image: AssetImage("assets/images/exemple_cover.png"),
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(15, 25, 15, 25),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AutoSizeText(
|
||||
"France, Lyon",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
maxFontSize: 20,
|
||||
),
|
||||
Image(
|
||||
image: AssetImage("assets/images/camera_icon.png"),
|
||||
width: 30,
|
||||
),
|
||||
AutoSizeText(
|
||||
"10 Juil. 2023",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white, fontSize: 13.sp),
|
||||
maxFontSize: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(15, 0, 10, 25),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: TextFormField(
|
||||
keyboardAppearance: Brightness.dark,
|
||||
minLines: 1,
|
||||
cursorColor: primaryColor,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w300),
|
||||
maxLines: 4,
|
||||
maxLength: 120,
|
||||
decoration: InputDecoration(
|
||||
counterStyle: GoogleFonts.plusJakartaSans(
|
||||
color: grayText, fontSize: 9),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10))),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(top: 0, bottom: 0, left: 0),
|
||||
fillColor: Colors.transparent,
|
||||
filled: true,
|
||||
focusColor: Colors.transparent,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10))),
|
||||
hintText: 'Description...',
|
||||
hintStyle: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w300),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:animated_appear/animated_appear.dart';
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:circular_reveal_animation/circular_reveal_animation.dart';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:insta_image_viewer/insta_image_viewer.dart';
|
||||
import 'package:justmusic/values/constants.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../model/Music.dart';
|
||||
import '../screens/search_location_screen.dart';
|
||||
import 'buttonPostComponent.dart';
|
||||
|
||||
class EditablePostComponent extends StatefulWidget {
|
||||
final Music? music;
|
||||
const EditablePostComponent({Key? key, this.music}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<EditablePostComponent> createState() => _EditablePostComponentState();
|
||||
}
|
||||
|
||||
class _EditablePostComponentState extends State<EditablePostComponent>
|
||||
with TickerProviderStateMixin {
|
||||
final ImagePicker picker = ImagePicker();
|
||||
late Animation<double> animation;
|
||||
late AnimationController animationController;
|
||||
late AnimationController _controller;
|
||||
File? image;
|
||||
Tuple2<String, String>? selectedCity;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 400),
|
||||
);
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 400),
|
||||
);
|
||||
animation = CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOutSine,
|
||||
);
|
||||
animationController.forward();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future pickImage(ImageSource source) async {
|
||||
try {
|
||||
final image = await ImagePicker().pickImage(source: source);
|
||||
if (image == null) return;
|
||||
final imageTemp = File(image.path);
|
||||
setState(() {
|
||||
this.image = imageTemp;
|
||||
});
|
||||
} on PlatformException catch (e) {
|
||||
print('Failed to pick image: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void _selectLocation(Tuple2<String, String> location) {
|
||||
Navigator.pop(context);
|
||||
setState(() {
|
||||
selectedCity = location;
|
||||
});
|
||||
}
|
||||
|
||||
void searchLocation() {
|
||||
showModalBottomSheet(
|
||||
transitionAnimationController: _controller,
|
||||
barrierColor: Colors.black.withOpacity(0.7),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 1,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 600,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: ((context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||
child: SearchCityScreen(callback: _selectLocation));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: 400, minHeight: 500),
|
||||
width: double.infinity,
|
||||
color: warningBttnColor,
|
||||
child: Column(
|
||||
children: [
|
||||
CircularRevealAnimation(
|
||||
animation: animation,
|
||||
centerOffset: Offset(30.w, -100),
|
||||
child: Stack(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 1 / 1,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
// add border
|
||||
border: Border.all(width: 3.0, color: grayColor),
|
||||
// set border radius
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
// implement image
|
||||
child: widget.music == null
|
||||
? Container(
|
||||
color: grayColor,
|
||||
width: double.infinity,
|
||||
)
|
||||
: Image(
|
||||
image:
|
||||
NetworkImage(widget.music?.cover ?? ""),
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
image != null
|
||||
? Positioned(
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: AnimatedAppear(
|
||||
delay: Duration(milliseconds: 500),
|
||||
duration: Duration(milliseconds: 400),
|
||||
child: Container(
|
||||
width: 110,
|
||||
height: 110,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: FileImage(image!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
color: grayColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
style: BorderStyle.solid,
|
||||
color: Colors.white,
|
||||
width: 4)),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: InstaImageViewer(
|
||||
backgroundIsTransparent: true,
|
||||
child: Image(
|
||||
image: FileImage(image!),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
))
|
||||
: Container()
|
||||
],
|
||||
)),
|
||||
widget.music != null
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 8,
|
||||
child: TextScroll(
|
||||
(widget.music?.title)!,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
height: 1,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 26.h),
|
||||
mode: TextScrollMode.endless,
|
||||
pauseBetween: Duration(milliseconds: 500),
|
||||
velocity:
|
||||
Velocity(pixelsPerSecond: Offset(20, 0)),
|
||||
)),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 10.h, right: 5.w, left: 5.w),
|
||||
child: ClipOval(
|
||||
child: Container(
|
||||
width: 5.h,
|
||||
height: 5.h,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
flex: 6,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 2),
|
||||
child: TextScroll(
|
||||
(widget.music?.artists[0].name)!,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
height: 1,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w300,
|
||||
fontSize: 16.h),
|
||||
mode: TextScrollMode.endless,
|
||||
velocity:
|
||||
Velocity(pixelsPerSecond: Offset(50, 20)),
|
||||
pauseBetween: Duration(milliseconds: 500),
|
||||
),
|
||||
)),
|
||||
Container(width: 10),
|
||||
AutoSizeText(
|
||||
"2013",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
fontWeight: FontWeight.w300,
|
||||
fontSize: 16.h),
|
||||
textAlign: TextAlign.end,
|
||||
maxFontSize: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(15, 15, 15, 25),
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
manageImage();
|
||||
},
|
||||
child: PhotoPostComponent(
|
||||
empty: image == null,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
manageLocation();
|
||||
},
|
||||
child: LocationPostComponent(
|
||||
empty: selectedCity == null,
|
||||
location: selectedCity,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(15, 0, 10, 25),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: TextFormField(
|
||||
keyboardAppearance: Brightness.dark,
|
||||
minLines: 1,
|
||||
cursorColor: primaryColor,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w300),
|
||||
maxLines: 4,
|
||||
maxLength: 120,
|
||||
decoration: InputDecoration(
|
||||
counterStyle: GoogleFonts.plusJakartaSans(
|
||||
color: grayText, fontSize: 9),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10))),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(top: 0, bottom: 0, left: 0),
|
||||
fillColor: Colors.transparent,
|
||||
filled: true,
|
||||
focusColor: Colors.transparent,
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(width: 0, color: Colors.transparent),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10))),
|
||||
hintText: 'Description...',
|
||||
hintStyle: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w300),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
void manageImage() {
|
||||
if (image != null) {
|
||||
setState(() {
|
||||
image = null;
|
||||
});
|
||||
} else {
|
||||
_showActionSheet(context);
|
||||
}
|
||||
}
|
||||
|
||||
void manageLocation() {
|
||||
if (selectedCity != null) {
|
||||
setState(() {
|
||||
selectedCity = null;
|
||||
});
|
||||
} else {
|
||||
searchLocation();
|
||||
}
|
||||
}
|
||||
|
||||
void _showActionSheet(BuildContext context) {
|
||||
showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
barrierColor: Colors.black.withOpacity(0.5),
|
||||
builder: (BuildContext context) => Container(
|
||||
color: Colors.black,
|
||||
child: CupertinoActionSheet(
|
||||
title: Text(
|
||||
'Ajouter une photo',
|
||||
style: GoogleFonts.plusJakartaSans(fontWeight: FontWeight.bold),
|
||||
),
|
||||
actions: <CupertinoActionSheetAction>[
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
pickImage(ImageSource.gallery);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Galerie'),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
pickImage(ImageSource.camera);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Prendre un selfie'),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
isDestructiveAction: true,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Annuler'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,100 +1,113 @@
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/components/play_button_component.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
import '../model/Music.dart';
|
||||
|
||||
class MusicListComponent extends StatelessWidget {
|
||||
final Music music;
|
||||
const MusicListComponent({
|
||||
Key? key,
|
||||
required this.music,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(bottom: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
if (music.cover != null) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
child: music.cover != null
|
||||
? FadeInImage.assetNetwork(
|
||||
height: 60,
|
||||
width: 60,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: "assets/images/loadingPlaceholder.gif",
|
||||
image: music.cover!)
|
||||
: Container(
|
||||
height: 60,
|
||||
width: 60,
|
||||
color: Colors.grey,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Image(
|
||||
image: AssetImage("assets/images/exemple_cover.png"),
|
||||
height: 60,
|
||||
width: 60,
|
||||
);
|
||||
}
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 8,
|
||||
child: ScrollConfiguration(
|
||||
behavior:
|
||||
ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: TextScroll(
|
||||
music.title ?? "Unknown",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700),
|
||||
mode: TextScrollMode.endless,
|
||||
pauseBetween: Duration(milliseconds: 2500),
|
||||
velocity: Velocity(pixelsPerSecond: Offset(30, 0)),
|
||||
intervalSpaces: 10,
|
||||
),
|
||||
)),
|
||||
Icon(
|
||||
Icons.explicit,
|
||||
color: Colors.grey.withOpacity(0.7),
|
||||
size: 17,
|
||||
),
|
||||
],
|
||||
),
|
||||
ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: Text(
|
||||
music.artists.first.name ?? "Unknown",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.grey, fontWeight: FontWeight.w400),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
PlayButtonComponent(
|
||||
urlPreview: music.previewUrl,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/components/play_button_component.dart';
|
||||
import 'package:text_scroll/text_scroll.dart';
|
||||
import '../model/Music.dart';
|
||||
|
||||
class MusicListComponent extends StatelessWidget {
|
||||
final Music music;
|
||||
final bool playing;
|
||||
final int index;
|
||||
final Function(int) callback;
|
||||
MusicListComponent({
|
||||
Key? key,
|
||||
required this.music,
|
||||
required this.playing,
|
||||
required this.callback,
|
||||
required this.index,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.only(bottom: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
if (music.cover != null) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
child: music.cover != null
|
||||
? FadeInImage.assetNetwork(
|
||||
height: 60,
|
||||
width: 60,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: "assets/images/loadingPlaceholder.gif",
|
||||
image: music.cover!)
|
||||
: Container(
|
||||
height: 60,
|
||||
width: 60,
|
||||
color: Colors.grey,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Image(
|
||||
image: AssetImage("assets/images/exemple_cover.png"),
|
||||
height: 60,
|
||||
width: 60,
|
||||
);
|
||||
}
|
||||
}),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 8,
|
||||
child: ScrollConfiguration(
|
||||
behavior:
|
||||
ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: TextScroll(
|
||||
music.title ?? "Unknown",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700),
|
||||
mode: TextScrollMode.endless,
|
||||
pauseBetween: Duration(milliseconds: 2500),
|
||||
velocity: Velocity(pixelsPerSecond: Offset(30, 0)),
|
||||
intervalSpaces: 10,
|
||||
),
|
||||
)),
|
||||
music.explicit
|
||||
? Icon(
|
||||
Icons.explicit,
|
||||
color: Colors.grey.withOpacity(0.7),
|
||||
size: 17,
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: Text(
|
||||
music.artists.first.name ?? "Unknown",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.grey, fontWeight: FontWeight.w400),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
music.previewUrl != null
|
||||
? PlayButtonComponent(
|
||||
music: music,
|
||||
callback: callback,
|
||||
playing: playing,
|
||||
index: index,
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +1,72 @@
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_animated_play_button/flutter_animated_play_button.dart';
|
||||
import 'package:ionicons/ionicons.dart';
|
||||
|
||||
class PlayButtonComponent extends StatefulWidget {
|
||||
final String? urlPreview;
|
||||
const PlayButtonComponent({Key? key, required this.urlPreview})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<PlayButtonComponent> createState() => _PlayButtonComponentState();
|
||||
}
|
||||
|
||||
class _PlayButtonComponentState extends State<PlayButtonComponent> {
|
||||
bool isPlaying = true;
|
||||
final player = AudioPlayer();
|
||||
void switchStatePlaying() {
|
||||
setState(() {
|
||||
isPlaying = !isPlaying;
|
||||
});
|
||||
stopSong();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
player.onPlayerComplete.listen((event) {
|
||||
switchStatePlaying();
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!isPlaying) {
|
||||
playSong();
|
||||
} else {}
|
||||
return isPlaying
|
||||
? GestureDetector(
|
||||
onTap: switchStatePlaying,
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: Icon(
|
||||
Ionicons.play_circle_outline,
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
size: 30,
|
||||
)),
|
||||
)
|
||||
: GestureDetector(
|
||||
onTap: switchStatePlaying,
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: AnimatedPlayButton(
|
||||
stopped: false,
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
onPressed: () {},
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> playSong() async {
|
||||
if (widget.urlPreview != null) {
|
||||
await player.play(UrlSource(widget.urlPreview ?? ""));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> stopSong() async {
|
||||
await player.stop();
|
||||
}
|
||||
}
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_animated_play_button/flutter_animated_play_button.dart';
|
||||
import 'package:ionicons/ionicons.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/Music.dart';
|
||||
|
||||
class PlayButtonComponent extends StatefulWidget {
|
||||
final Music music;
|
||||
final Function callback;
|
||||
final int index;
|
||||
final bool playing;
|
||||
const PlayButtonComponent(
|
||||
{Key? key,
|
||||
required this.music,
|
||||
required this.callback,
|
||||
required this.playing,
|
||||
required this.index})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<PlayButtonComponent> createState() => _PlayButtonComponentState();
|
||||
}
|
||||
|
||||
class _PlayButtonComponentState extends State<PlayButtonComponent> {
|
||||
final player = AudioPlayer();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
MyApp.audioPlayer.onPlayerComplete.listen((event) {
|
||||
widget.callback(widget.index);
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return !widget.playing
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
widget.music.playSong();
|
||||
widget.callback(widget.index);
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: Icon(
|
||||
Ionicons.play_circle_outline,
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
size: 30,
|
||||
)),
|
||||
)
|
||||
: GestureDetector(
|
||||
onTap: () {
|
||||
widget.music.stopSong();
|
||||
|
||||
widget.callback(widget.index);
|
||||
},
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: AnimatedPlayButton(
|
||||
stopped: false,
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
onPressed: () {
|
||||
print("cc");
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,74 @@
|
||||
import 'Artist.dart';
|
||||
|
||||
class Music {
|
||||
final String _id;
|
||||
String? _title;
|
||||
String? _cover;
|
||||
String? _previewUrl;
|
||||
DateTime? _date;
|
||||
double? _duration;
|
||||
bool _explicit = false;
|
||||
List<Artist> _artists;
|
||||
|
||||
// Constructor
|
||||
Music(this._id, this._title, this._cover, this._previewUrl, this._date,
|
||||
this._duration, this._explicit, this._artists);
|
||||
|
||||
//Getters and setters
|
||||
String? get id => _id;
|
||||
|
||||
String? get title => _title;
|
||||
|
||||
set title(String? value) {
|
||||
_title = value;
|
||||
}
|
||||
|
||||
String? get cover => _cover;
|
||||
|
||||
set cover(String? value) {
|
||||
_cover = value;
|
||||
}
|
||||
|
||||
String? get previewUrl => _previewUrl;
|
||||
|
||||
set previewUrl(String? value) {
|
||||
_previewUrl = value;
|
||||
}
|
||||
|
||||
DateTime? get date => _date;
|
||||
|
||||
set date(DateTime? value) {
|
||||
_date = value;
|
||||
}
|
||||
|
||||
double? get duration => _duration;
|
||||
|
||||
set duration(double? value) {
|
||||
_duration = value;
|
||||
}
|
||||
|
||||
bool get explicit => _explicit;
|
||||
|
||||
set explicit(bool value) {
|
||||
_explicit = value;
|
||||
}
|
||||
|
||||
List<Artist> get artists => _artists;
|
||||
|
||||
set artists(List<Artist> value) {
|
||||
_artists = value;
|
||||
}
|
||||
}
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
|
||||
import 'Artist.dart';
|
||||
import '../main.dart';
|
||||
|
||||
class Music {
|
||||
final String _id;
|
||||
String? _title;
|
||||
String? _cover;
|
||||
String? _previewUrl;
|
||||
int? _date;
|
||||
double? _duration;
|
||||
bool _explicit = false;
|
||||
List<Artist> _artists;
|
||||
|
||||
// Constructor
|
||||
Music(this._id, this._title, this._cover, this._previewUrl, this._date,
|
||||
this._duration, this._explicit, this._artists);
|
||||
|
||||
//Getters and setters
|
||||
String? get id => _id;
|
||||
|
||||
String? get title => _title;
|
||||
|
||||
set title(String? value) {
|
||||
_title = value;
|
||||
}
|
||||
|
||||
String? get cover => _cover;
|
||||
|
||||
set cover(String? value) {
|
||||
_cover = value;
|
||||
}
|
||||
|
||||
String? get previewUrl => _previewUrl;
|
||||
|
||||
set previewUrl(String? value) {
|
||||
_previewUrl = value;
|
||||
}
|
||||
|
||||
int? get date => _date;
|
||||
|
||||
set date(int? value) {
|
||||
_date = value;
|
||||
}
|
||||
|
||||
double? get duration => _duration;
|
||||
|
||||
set duration(double? value) {
|
||||
_duration = value;
|
||||
}
|
||||
|
||||
bool get explicit => _explicit;
|
||||
|
||||
set explicit(bool value) {
|
||||
_explicit = value;
|
||||
}
|
||||
|
||||
List<Artist> get artists => _artists;
|
||||
|
||||
set artists(List<Artist> value) {
|
||||
_artists = value;
|
||||
}
|
||||
|
||||
Future<void> playSong() async {
|
||||
if (previewUrl != null) {
|
||||
await MyApp.audioPlayer.play(UrlSource(previewUrl!));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> stopSong() async {
|
||||
await MyApp.audioPlayer.stop();
|
||||
}
|
||||
}
|
||||
|
@ -1,297 +1,301 @@
|
||||
import 'package:circular_reveal_animation/circular_reveal_animation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../components/comment_component.dart';
|
||||
import '../components/post_component.dart';
|
||||
import '../components/top_nav_bar_component.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class FeedScreen extends StatefulWidget {
|
||||
const FeedScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FeedScreen> createState() => _FeedScreenState();
|
||||
}
|
||||
|
||||
class _FeedScreenState extends State<FeedScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController animationController;
|
||||
late Animation<double> animation;
|
||||
late List<PostComponent> friendFeed;
|
||||
late List<PostComponent> discoveryFeed;
|
||||
late List<PostComponent> displayFeed;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
friendFeed = [
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
];
|
||||
discoveryFeed = [
|
||||
PostComponent(callback: openDetailPost),
|
||||
];
|
||||
displayFeed = friendFeed;
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 400),
|
||||
);
|
||||
animation = CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOutSine,
|
||||
);
|
||||
animationController.forward();
|
||||
}
|
||||
|
||||
Future<void> resetFullScreen() async {
|
||||
await SystemChannels.platform.invokeMethod<void>(
|
||||
'SystemChrome.restoreSystemUIOverlays',
|
||||
);
|
||||
}
|
||||
|
||||
void changeFeed(bool choice) {
|
||||
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
|
||||
if (choice) {
|
||||
setState(() {
|
||||
animationController.reset();
|
||||
displayFeed = friendFeed;
|
||||
animationController.forward();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
animationController.reset();
|
||||
displayFeed = discoveryFeed;
|
||||
animationController.forward();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void openDetailPost() {
|
||||
showModalBottomSheet(
|
||||
backgroundColor: bgModal,
|
||||
elevation: 1,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 600,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: ((context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
resetFullScreen();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: 720.h,
|
||||
margin: const EdgeInsets.only(top: 10),
|
||||
child: 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(
|
||||
child: Wrap(
|
||||
// to apply margin in the main axis of the wrap
|
||||
runSpacing: 10,
|
||||
children: [
|
||||
PostComponent(
|
||||
callback: null,
|
||||
),
|
||||
Container(height: 10),
|
||||
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)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
backgroundColor: bgColor,
|
||||
body: Stack(
|
||||
children: [
|
||||
CircularRevealAnimation(
|
||||
animation: animation,
|
||||
centerOffset: Offset(30.w, -100),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Align(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 600),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: defaultPadding),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 100.h),
|
||||
child: SingleChildScrollView(
|
||||
child: Wrap(
|
||||
runSpacing: 60,
|
||||
children: displayFeed,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: Container(
|
||||
height: 240.h,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(begin: Alignment.topRight, stops: [
|
||||
0.3,
|
||||
1
|
||||
], colors: [
|
||||
bgColor.withOpacity(0.9),
|
||||
bgColor.withOpacity(0)
|
||||
])),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 800),
|
||||
child: TopNavBarComponent(callback: changeFeed),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:circular_reveal_animation/circular_reveal_animation.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../components/comment_component.dart';
|
||||
import '../components/post_component.dart';
|
||||
import '../components/top_nav_bar_component.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class FeedScreen extends StatefulWidget {
|
||||
const FeedScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FeedScreen> createState() => _FeedScreenState();
|
||||
}
|
||||
|
||||
class _FeedScreenState extends State<FeedScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController animationController;
|
||||
late Animation<double> animation;
|
||||
late List<PostComponent> friendFeed;
|
||||
late List<PostComponent> discoveryFeed;
|
||||
late List<PostComponent> displayFeed;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
friendFeed = [
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
PostComponent(
|
||||
callback: openDetailPost,
|
||||
),
|
||||
];
|
||||
discoveryFeed = [
|
||||
PostComponent(callback: openDetailPost),
|
||||
];
|
||||
displayFeed = friendFeed;
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 400),
|
||||
);
|
||||
animation = CurvedAnimation(
|
||||
parent: animationController,
|
||||
curve: Curves.easeInOutSine,
|
||||
);
|
||||
animationController.forward();
|
||||
}
|
||||
|
||||
Future<void> resetFullScreen() async {
|
||||
await SystemChannels.platform.invokeMethod<void>(
|
||||
'SystemChrome.restoreSystemUIOverlays',
|
||||
);
|
||||
}
|
||||
|
||||
void changeFeed(bool choice) {
|
||||
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
|
||||
if (choice) {
|
||||
setState(() {
|
||||
animationController.reset();
|
||||
displayFeed = friendFeed;
|
||||
animationController.forward();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
animationController.reset();
|
||||
displayFeed = discoveryFeed;
|
||||
animationController.forward();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void openDetailPost() {
|
||||
showModalBottomSheet(
|
||||
backgroundColor: bgModal,
|
||||
elevation: 1,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 600,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: ((BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
resetFullScreen();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: 720.h,
|
||||
margin: const EdgeInsets.only(top: 10),
|
||||
child: 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: [
|
||||
PostComponent(
|
||||
callback: null,
|
||||
),
|
||||
Container(height: 10),
|
||||
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)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
backgroundColor: bgColor,
|
||||
body: Stack(
|
||||
children: [
|
||||
CircularRevealAnimation(
|
||||
animation: animation,
|
||||
centerOffset: Offset(30.w, -100),
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(
|
||||
decelerationRate: ScrollDecelerationRate.fast),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Align(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 600),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: defaultPadding),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 100.h),
|
||||
child: SingleChildScrollView(
|
||||
child: Wrap(
|
||||
runSpacing: 60,
|
||||
children: displayFeed,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
IgnorePointer(
|
||||
child: Container(
|
||||
height: 240.h,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(begin: Alignment.topRight, stops: [
|
||||
0.3,
|
||||
1
|
||||
], colors: [
|
||||
bgColor.withOpacity(0.9),
|
||||
bgColor.withOpacity(0)
|
||||
])),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 800),
|
||||
child: TopNavBarComponent(callback: changeFeed),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,126 +1,125 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:justmusic/components/back_button.dart';
|
||||
import 'package:justmusic/screens/search_song_screen.dart';
|
||||
import '../components/editable_post_component.dart';
|
||||
import '../components/post_button_component.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class PostScreen extends StatefulWidget {
|
||||
const PostScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PostScreen> createState() => _PostScreenState();
|
||||
}
|
||||
|
||||
class _PostScreenState extends State<PostScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final scrollController = ScrollController();
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 400),
|
||||
);
|
||||
|
||||
_animation = Tween<double>(begin: 0.0, end: 400.0).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.easeOut,
|
||||
),
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void openDetailPost() {
|
||||
showModalBottomSheet(
|
||||
transitionAnimationController: _controller,
|
||||
barrierColor: Colors.black.withOpacity(0.7),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 1,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 600,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: ((context) {
|
||||
return const ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||
child: SearchSongScreen());
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
backgroundColor: bgColor,
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size(double.infinity, 80),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: defaultPadding,
|
||||
right: defaultPadding,
|
||||
top: defaultPadding),
|
||||
child: Row(
|
||||
children: [BackButtonComponent()],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: defaultPadding, right: defaultPadding),
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/background_justMusic.png"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.topCenter,
|
||||
children: [
|
||||
ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: openDetailPost,
|
||||
child: EditablePostComponent(),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
PostButtonComponent(),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:justmusic/components/back_button.dart';
|
||||
import 'package:justmusic/screens/search_song_screen.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import '../components/editable_post_component.dart';
|
||||
import '../components/post_button_component.dart';
|
||||
import '../model/Music.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class PostScreen extends StatefulWidget {
|
||||
const PostScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<PostScreen> createState() => _PostScreenState();
|
||||
}
|
||||
|
||||
class _PostScreenState extends State<PostScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final scrollController = ScrollController();
|
||||
late AnimationController _controller;
|
||||
|
||||
Music? selectedMusic;
|
||||
Tuple2<String, String>? selectedCity;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 400),
|
||||
);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _selectMusic(Music music) {
|
||||
Navigator.pop(context);
|
||||
setState(() {
|
||||
selectedMusic = music;
|
||||
});
|
||||
}
|
||||
|
||||
void openSearchSong() {
|
||||
showModalBottomSheet(
|
||||
transitionAnimationController: _controller,
|
||||
barrierColor: Colors.black.withOpacity(0.7),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 1,
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 600,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
builder: ((context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20)),
|
||||
child: SearchSongScreen(callback: _selectMusic));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
backgroundColor: bgColor,
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: const PreferredSize(
|
||||
preferredSize: Size(double.infinity, 80),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: defaultPadding,
|
||||
right: defaultPadding,
|
||||
top: defaultPadding),
|
||||
child: Row(
|
||||
children: [BackButtonComponent()],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: defaultPadding, right: defaultPadding),
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/background_justMusic.png"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: false),
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: openSearchSong,
|
||||
child: EditablePostComponent(music: selectedMusic)),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
PostButtonComponent(empty: selectedMusic == null),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,146 +1,148 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/values/icons.dart';
|
||||
import '../components/profile_component.dart';
|
||||
import '../components/setting_part_component.dart';
|
||||
import '../main.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
const ProfileScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
@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.centerLeft,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: Image(
|
||||
image: AssetImage("assets/images/return_icon.png"),
|
||||
height: 8,
|
||||
),
|
||||
)),
|
||||
Align(
|
||||
child: Text(
|
||||
"Profile",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: bgColor,
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: settingPadding),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 68.h, bottom: 40),
|
||||
child:
|
||||
ProfileComponent(user: MyApp.userViewModel.userCurrent),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 12, left: defaultPadding),
|
||||
child: Text(
|
||||
"Compte",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Column(
|
||||
children: const [
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.profile,
|
||||
label: 'Compte',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.history,
|
||||
label: 'Historiques des capsules',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.spotify,
|
||||
label: 'Lier un compte Spotify',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.trash,
|
||||
label: 'Supprimer mon compte',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.cross,
|
||||
label: 'Déconnexion',
|
||||
important: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 12, left: defaultPadding, top: 40),
|
||||
child: Text(
|
||||
"Préférences",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Column(
|
||||
children: const [
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.theme,
|
||||
label: 'Thême de l\'application',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.notification,
|
||||
label: 'Notifications',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/values/icons.dart';
|
||||
import '../components/profile_component.dart';
|
||||
import '../components/setting_part_component.dart';
|
||||
import '../main.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
const ProfileScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
@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.centerLeft,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: Image(
|
||||
image: AssetImage("assets/images/return_icon.png"),
|
||||
height: 8,
|
||||
),
|
||||
)),
|
||||
Align(
|
||||
child: Text(
|
||||
"Profile",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: bgColor,
|
||||
child: SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(
|
||||
decelerationRate: ScrollDecelerationRate.fast),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: settingPadding),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 68.h, bottom: 40),
|
||||
child:
|
||||
ProfileComponent(user: MyApp.userViewModel.userCurrent),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 12, left: defaultPadding),
|
||||
child: Text(
|
||||
"Compte",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Column(
|
||||
children: const [
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.profile,
|
||||
label: 'Compte',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.history,
|
||||
label: 'Historiques des capsules',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.spotify,
|
||||
label: 'Lier un compte Spotify',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.trash,
|
||||
label: 'Supprimer mon compte',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.cross,
|
||||
label: 'Déconnexion',
|
||||
important: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
bottom: 12, left: defaultPadding, top: 40),
|
||||
child: Text(
|
||||
"Préférences",
|
||||
style: GoogleFonts.plusJakartaSans(
|
||||
color: grayText,
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Column(
|
||||
children: const [
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.theme,
|
||||
label: 'Thême de l\'application',
|
||||
),
|
||||
SettingPartComponent(
|
||||
icon: JustMusicIcon.notification,
|
||||
label: 'Notifications',
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../components/city_list_component.dart';
|
||||
import '../services/GeoApi.dart';
|
||||
import '../values/constants.dart';
|
||||
|
||||
class SearchCityScreen extends StatefulWidget {
|
||||
final Function callback;
|
||||
const SearchCityScreen({Key? key, required this.callback}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SearchCityScreen> createState() => _SearchCityScreenState();
|
||||
}
|
||||
|
||||
class _SearchCityScreenState extends State<SearchCityScreen> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final GeoApi api = GeoApi();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double screenHeight = MediaQuery.of(context).size.height;
|
||||
return BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: 60.0,
|
||||
sigmaY: 60.0,
|
||||
),
|
||||
child: Container(
|
||||
color: bgAppBar.withOpacity(0.5),
|
||||
height: screenHeight - 50,
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(20))),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Flexible(
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: true),
|
||||
child: FutureBuilder(
|
||||
future: api.getNearbyCities(),
|
||||
builder:
|
||||
(BuildContext context, AsyncSnapshot<dynamic> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return ListView.builder(
|
||||
physics: const BouncingScrollPhysics(
|
||||
decelerationRate: ScrollDecelerationRate.fast),
|
||||
controller: _scrollController,
|
||||
itemCount: snapshot.data.length,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
widget.callback(snapshot.data[index]);
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: CityListComponent(
|
||||
location: snapshot.data[index],
|
||||
),
|
||||
));
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: CupertinoActivityIndicator(
|
||||
radius: 15,
|
||||
color: grayColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,169 +1,212 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/model/Music.dart';
|
||||
|
||||
import '../components/music_list_component.dart';
|
||||
import '../values/constants.dart';
|
||||
import '../main.dart';
|
||||
|
||||
class SearchSongScreen extends StatefulWidget {
|
||||
const SearchSongScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SearchSongScreen> createState() => _SearchSongScreenState();
|
||||
}
|
||||
|
||||
class _SearchSongScreenState extends State<SearchSongScreen> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final TextEditingController _textEditingController = TextEditingController();
|
||||
|
||||
Future<void> resetFullScreen() async {
|
||||
await SystemChannels.platform.invokeMethod<void>(
|
||||
'SystemChrome.restoreSystemUIOverlays',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
Future<void> _scrollListener() async {
|
||||
if (_scrollController.position.pixels ==
|
||||
_scrollController.position.maxScrollExtent) {
|
||||
filteredData.addAll(await MyApp.musicViewModel.getMusicsWithName(
|
||||
_textEditingController.text,
|
||||
limit: 10,
|
||||
offset: filteredData.length));
|
||||
setState(() {
|
||||
filteredData = filteredData;
|
||||
});
|
||||
}
|
||||
if (_scrollController.offset >=
|
||||
_scrollController.position.maxScrollExtent &&
|
||||
!_scrollController.position.outOfRange) {
|
||||
setState(() {
|
||||
//you can do anything here
|
||||
});
|
||||
}
|
||||
if (_scrollController.offset <=
|
||||
_scrollController.position.minScrollExtent &&
|
||||
!_scrollController.position.outOfRange) {
|
||||
setState(() {
|
||||
Timer(Duration(milliseconds: 1), () => _scrollController.jumpTo(0));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<Music> filteredData = [];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double screenHeight = MediaQuery.of(context).size.height;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
resetFullScreen();
|
||||
}
|
||||
},
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: 60.0,
|
||||
sigmaY: 60.0,
|
||||
),
|
||||
child: Container(
|
||||
color: bgAppBar.withOpacity(0.5),
|
||||
height: screenHeight - 50,
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(20))),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 10, left: 20, right: 20),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
controller: _textEditingController,
|
||||
keyboardAppearance: Brightness.dark,
|
||||
onEditingComplete: resetFullScreen,
|
||||
onChanged: (value) async {
|
||||
if (_textEditingController.text.isEmpty) {
|
||||
} else if (value == " ") {
|
||||
print("popular");
|
||||
} else {
|
||||
filteredData = await MyApp.musicViewModel
|
||||
.getMusicsWithName(value);
|
||||
setState(() {
|
||||
filteredData = filteredData;
|
||||
});
|
||||
}
|
||||
},
|
||||
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 son',
|
||||
hintStyle:
|
||||
GoogleFonts.plusJakartaSans(color: grayColor)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: true),
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount: filteredData.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: MusicListComponent(music: filteredData[index]),
|
||||
);
|
||||
}),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
import 'dart:async';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/Material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:justmusic/model/Music.dart';
|
||||
|
||||
import '../components/music_list_component.dart';
|
||||
import '../values/constants.dart';
|
||||
import '../main.dart';
|
||||
|
||||
class SearchSongScreen extends StatefulWidget {
|
||||
final Function callback;
|
||||
const SearchSongScreen({Key? key, required this.callback}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SearchSongScreen> createState() => _SearchSongScreenState();
|
||||
}
|
||||
|
||||
class _SearchSongScreenState extends State<SearchSongScreen> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final TextEditingController _textEditingController = TextEditingController();
|
||||
int? playingIndex;
|
||||
|
||||
Future<void> resetFullScreen() async {
|
||||
await SystemChannels.platform.invokeMethod<void>(
|
||||
'SystemChrome.restoreSystemUIOverlays',
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
Future<void> _scrollListener() async {
|
||||
if (_scrollController.position.pixels ==
|
||||
_scrollController.position.maxScrollExtent) {
|
||||
filteredData.addAll(await MyApp.musicViewModel.getMusicsWithName(
|
||||
_textEditingController.text,
|
||||
limit: 10,
|
||||
offset: filteredData.length));
|
||||
setState(() {
|
||||
filteredData = filteredData;
|
||||
});
|
||||
}
|
||||
if (_scrollController.offset >=
|
||||
_scrollController.position.maxScrollExtent &&
|
||||
!_scrollController.position.outOfRange) {
|
||||
setState(() {
|
||||
//you can do anything here
|
||||
});
|
||||
}
|
||||
if (_scrollController.offset <=
|
||||
_scrollController.position.minScrollExtent &&
|
||||
!_scrollController.position.outOfRange) {
|
||||
setState(() {
|
||||
Timer(Duration(milliseconds: 1), () => _scrollController.jumpTo(0));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<Music> filteredData = [];
|
||||
|
||||
void playMusic(int index) {
|
||||
if (playingIndex == index) {
|
||||
setState(() {
|
||||
playingIndex = null;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
playingIndex = index;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double screenHeight = MediaQuery.of(context).size.height;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
resetFullScreen();
|
||||
}
|
||||
},
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: 60.0,
|
||||
sigmaY: 60.0,
|
||||
),
|
||||
child: Container(
|
||||
color: bgAppBar.withOpacity(0.5),
|
||||
height: screenHeight - 50,
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF3A3A3A).withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(20))),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 10, left: 20, right: 20),
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
autofocus: true,
|
||||
controller: _textEditingController,
|
||||
keyboardAppearance: Brightness.dark,
|
||||
onEditingComplete: resetFullScreen,
|
||||
onSubmitted: (value) async {
|
||||
if (_textEditingController.text.isEmpty) {
|
||||
} else if (value == " ") {
|
||||
print("popular");
|
||||
} else {
|
||||
filteredData = await MyApp.musicViewModel
|
||||
.getMusicsWithName(value);
|
||||
setState(() {
|
||||
filteredData = filteredData;
|
||||
});
|
||||
}
|
||||
},
|
||||
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 son',
|
||||
hintStyle:
|
||||
GoogleFonts.plusJakartaSans(color: grayColor)),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollBehavior().copyWith(scrollbars: true),
|
||||
child: ListView.builder(
|
||||
physics: const BouncingScrollPhysics(
|
||||
decelerationRate: ScrollDecelerationRate.fast),
|
||||
controller: _scrollController,
|
||||
itemCount: filteredData.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (playingIndex == index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
widget.callback(filteredData[index]);
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: MusicListComponent(
|
||||
music: filteredData[index],
|
||||
playing: true,
|
||||
callback: playMusic,
|
||||
index: index,
|
||||
),
|
||||
));
|
||||
}
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
widget.callback(filteredData[index]);
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: MusicListComponent(
|
||||
music: filteredData[index],
|
||||
playing: false,
|
||||
callback: playMusic,
|
||||
index: index,
|
||||
),
|
||||
));
|
||||
}),
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import '../values/keys.dart';
|
||||
|
||||
class GeoApi {
|
||||
final String apiKey = geoKey;
|
||||
Future<List<Tuple2<String, String>>?> getNearbyCities() async {
|
||||
try {
|
||||
LocationPermission permission = await Geolocator.checkPermission();
|
||||
bool serviceEnabled;
|
||||
|
||||
// Test if location services are enabled.
|
||||
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
// Location services are not enabled don't continue
|
||||
// accessing the position and request users of the
|
||||
// App to enable the location services.
|
||||
return Future.error('Location services are disabled.');
|
||||
}
|
||||
|
||||
permission = await Geolocator.checkPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
return Future.error('Location permissions are denied');
|
||||
}
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.deniedForever) {
|
||||
return Future.error(
|
||||
'Location permissions are permanently denied, we cannot request permissions.');
|
||||
}
|
||||
|
||||
Position position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.high);
|
||||
String apiUrl =
|
||||
'http://api.openweathermap.org/data/2.5/find?lat=${position.latitude}&lon=${position.longitude}&cnt=10&appid=$apiKey';
|
||||
var response = await http.get(Uri.parse(apiUrl));
|
||||
if (response.statusCode == 200) {
|
||||
var data = json.decode(response.body);
|
||||
List<dynamic> cities = data['list'];
|
||||
List<Tuple2<String, String>> cityInfo = cities.map((city) {
|
||||
String cityName = city['name'] as String;
|
||||
String countryName = city['sys']['country'] as String;
|
||||
return Tuple2(cityName, countryName);
|
||||
}).toList();
|
||||
return cityInfo;
|
||||
} else {
|
||||
print('Failed to fetch data');
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error: $e');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class Tuple {}
|
@ -1,26 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// All needed color in the project
|
||||
|
||||
const primaryColor = Color(0xFF643BF4);
|
||||
const secondaryColor = Color(0xFF1C1B23);
|
||||
const bgColor = Color(0xFF0C0C0C);
|
||||
const grayColor = Color(0xFF242424);
|
||||
const profileBttnColor = Color(0xFF232323);
|
||||
const warningBttnColor = Color(0xFF141414);
|
||||
const disabledBttnColor = Color(0xFF1F1B2E);
|
||||
const bgTextField = Color(0xFF1C1B23);
|
||||
const strokeTextField = Color(0xFF373546);
|
||||
const unactiveFeed = Color(0xFF848484);
|
||||
const gradiantPost = Color(0xFF0D0D0D);
|
||||
const bgModal = Color(0xFF1E1E1E);
|
||||
const textFieldMessage = Color(0xFF232323);
|
||||
const bgComment = Color(0xFF222222);
|
||||
const bgAppBar = Color(0xFF181818);
|
||||
const grayText = Color(0xFF898989);
|
||||
const settingColor = Color(0xFF232323);
|
||||
const searchBarColor = Color(0xFF161616);
|
||||
// All constants important too us
|
||||
|
||||
const defaultPadding = 30.0;
|
||||
const settingPadding = 12.0;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// All needed color in the project
|
||||
|
||||
const primaryColor = Color(0xFF643BF4);
|
||||
const secondaryColor = Color(0xFF1C1B23);
|
||||
const bgColor = Color(0xFF0C0C0C);
|
||||
const grayColor = Color(0xFF242424);
|
||||
const profileBttnColor = Color(0xFF232323);
|
||||
const warningBttnColor = Color(0xFF141414);
|
||||
const disabledBttnColor = Color(0xFF1F1B2E);
|
||||
const bgTextField = Color(0xFF1C1B23);
|
||||
const strokeTextField = Color(0xFF373546);
|
||||
const unactiveFeed = Color(0xFF848484);
|
||||
const gradiantPost = Color(0xFF0D0D0D);
|
||||
const bgModal = Color(0xFF1E1E1E);
|
||||
const textFieldMessage = Color(0xFF232323);
|
||||
const bgComment = Color(0xFF222222);
|
||||
const bgAppBar = Color(0xFF181818);
|
||||
const grayText = Color(0xFF898989);
|
||||
const settingColor = Color(0xFF232323);
|
||||
const searchBarColor = Color(0xFF161616);
|
||||
const postbutton = Color(0xFF1B1B1B);
|
||||
const fillButton = Color(0xFF633AF4);
|
||||
// All constants important too us
|
||||
|
||||
const defaultPadding = 30.0;
|
||||
const settingPadding = 12.0;
|
||||
|
@ -0,0 +1 @@
|
||||
const geoKey = "85a2724ad38b3994c2b7ebe1d239bbff";
|
@ -1,203 +1,224 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:justmusic/view_model/TokenSpotify.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../model/Artist.dart';
|
||||
import '../model/Music.dart';
|
||||
|
||||
class MusicViewModel {
|
||||
final String API_URL = "https://api.spotify.com/v1";
|
||||
late TokenSpotify _token;
|
||||
|
||||
MusicViewModel() {
|
||||
_token = new TokenSpotify();
|
||||
}
|
||||
|
||||
// Methods
|
||||
Future<Music> getMusic(String id) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(Uri.parse('$API_URL/tracks/$id'), headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists'].map((artist) {
|
||||
return Artist(artist['id'], artist['name'], '');
|
||||
}));
|
||||
|
||||
return Music(
|
||||
responseData['id'],
|
||||
responseData['name'],
|
||||
responseData['album']['images'][0]['url'],
|
||||
responseData['preview_url'],
|
||||
DateTime.parse(responseData['album']['release_date']),
|
||||
responseData['duration_ms'] / 1000,
|
||||
responseData['explicit'],
|
||||
artists);
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error retrieving music information : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
List<Music> _getMusicsFromResponse(Map<String, dynamic> responseData) {
|
||||
List<Music> musics = [];
|
||||
|
||||
List<dynamic> tracks = responseData['tracks']['items'];
|
||||
for (var track in tracks) {
|
||||
List<Artist> artists = List<Artist>.from(track['artists'].map((artist) {
|
||||
return Artist(artist['id'], artist['name'], '');
|
||||
}));
|
||||
|
||||
musics.add(Music(
|
||||
track['id'],
|
||||
track['name'],
|
||||
track['album']['images'][0]['url'],
|
||||
track['preview_url'],
|
||||
DateTime.now(),
|
||||
track['duration_ms'] / 1000,
|
||||
track['explicit'],
|
||||
artists));
|
||||
}
|
||||
|
||||
return musics;
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=track%3A$name&type=track&market=fr&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return _getMusicsFromResponse(responseData);
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithArtistName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=track&market=fr&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return _getMusicsFromResponse(responseData);
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<Artist> getArtistWithName(String name, {String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=artist&market=$market'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists']['items'].map((artist) {
|
||||
String image = '';
|
||||
if (!artist['images'].isEmpty) {
|
||||
image = artist['images'][0]['url'];
|
||||
}
|
||||
return Artist(artist['id'], artist['name'], image);
|
||||
}));
|
||||
|
||||
for (Artist a in artists) {
|
||||
if (a.name?.toLowerCase() == name.toLowerCase()) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
throw Exception('Artist not found : ${name}');
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error retrieving artist information : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Artist>> getArtistsWithName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=artist&market=$market&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists']['items'].map((artist) {
|
||||
String image = '';
|
||||
if (!artist['images'].isEmpty) {
|
||||
image = artist['images'][0]['url'];
|
||||
}
|
||||
return Artist(artist['id'], artist['name'], image);
|
||||
}));
|
||||
|
||||
return artists;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving artist : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getTopMusicsWithArtistId(String id,
|
||||
{String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse('$API_URL/artists/$id/top-tracks?market=$market'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
List<Music> musics = [];
|
||||
|
||||
List<dynamic> tracks = responseData['tracks'];
|
||||
for (var track in tracks) {
|
||||
List<Artist> artists = List<Artist>.from(track['artists'].map((artist) {
|
||||
return Artist(artist['id'], artist['name'], '');
|
||||
}));
|
||||
|
||||
musics.add(Music(
|
||||
track['id'],
|
||||
track['name'],
|
||||
track['album']['images'][0]['url'],
|
||||
track['preview_url'],
|
||||
DateTime.now(),
|
||||
track['duration_ms'] / 1000,
|
||||
track['explicit'],
|
||||
artists));
|
||||
}
|
||||
|
||||
return musics;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
}
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:justmusic/view_model/TokenSpotify.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../model/Artist.dart';
|
||||
import '../model/Music.dart';
|
||||
|
||||
class MusicViewModel {
|
||||
final String API_URL = "https://api.spotify.com/v1";
|
||||
late TokenSpotify _token;
|
||||
|
||||
MusicViewModel() {
|
||||
_token = new TokenSpotify();
|
||||
}
|
||||
|
||||
// Methods
|
||||
Future<Music> getMusic(String id) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(Uri.parse('$API_URL/tracks/$id'), headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists'].map((artist) {
|
||||
return Artist(artist['id'], artist['name'], '');
|
||||
}));
|
||||
|
||||
return _getMusicFromResponse(responseData);
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error retrieving music information : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Music _getMusicFromResponse(dynamic track) {
|
||||
List<Artist> artists = List<Artist>.from(track['artists'].map((artist) {
|
||||
return Artist(artist['id'], artist['name'], '');
|
||||
}));
|
||||
|
||||
return Music(
|
||||
track['id'],
|
||||
track['name'],
|
||||
track['album']['images'][0]['url'],
|
||||
track['preview_url'],
|
||||
int.parse(track['album']['release_date'].split('-')[0]),
|
||||
track['duration_ms'] / 1000,
|
||||
track['explicit'],
|
||||
artists);
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=track%3A$name&type=track&market=fr&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return List<Music>.from(responseData['tracks']['items'].map((track) {
|
||||
return _getMusicFromResponse(track);
|
||||
}));
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithArtistName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=track&market=fr&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return List<Music>.from(responseData['tracks']['items'].map((track) {
|
||||
return _getMusicFromResponse(track);
|
||||
}));
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<Artist> getArtistWithName(String name, {String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=artist&market=$market'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists']['items'].map((artist) {
|
||||
String image = '';
|
||||
if (!artist['images'].isEmpty) {
|
||||
image = artist['images'][0]['url'];
|
||||
}
|
||||
return Artist(artist['id'], artist['name'], image);
|
||||
}));
|
||||
|
||||
for (Artist a in artists) {
|
||||
if (a.name?.toLowerCase() == name.toLowerCase()) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
throw Exception('Artist not found : ${name}');
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error retrieving artist information : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Artist>> getArtistsWithName(String name,
|
||||
{int limit = 20, int offset = 0, String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
'$API_URL/search?q=artist%3A$name&type=artist&market=$market&limit=$limit&offset=$offset'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final responseData = jsonDecode(response.body);
|
||||
List<Artist> artists =
|
||||
List<Artist>.from(responseData['artists']['items'].map((artist) {
|
||||
String image = '';
|
||||
if (!artist['images'].isEmpty) {
|
||||
image = artist['images'][0]['url'];
|
||||
}
|
||||
return Artist(artist['id'], artist['name'], image);
|
||||
}));
|
||||
|
||||
return artists;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving artist : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getTopMusicsWithArtistId(String id,
|
||||
{String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http.get(
|
||||
Uri.parse('$API_URL/artists/$id/top-tracks?market=$market'),
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return List<Music>.from(responseData['tracks'].map((track) {
|
||||
return _getMusicFromResponse(track);
|
||||
}));
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithPlaylistId(String id,
|
||||
{String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
var response = await http
|
||||
.get(Uri.parse('$API_URL/playlists/$id?market=$market'), headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
|
||||
List<Music> musics = [];
|
||||
|
||||
List<dynamic> tracks = responseData['tracks']['items'];
|
||||
for (var track in tracks) {
|
||||
musics.add(_getMusicFromResponse(track['track']));
|
||||
}
|
||||
|
||||
return musics;
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Music>> getMusicsWithIds(List<String> ids,
|
||||
{String market = "FR"}) async {
|
||||
var accessToken = await _token.getAccessToken();
|
||||
String url = API_URL + '/tracks?market=$market&ids=';
|
||||
|
||||
if (ids.length == 0) return [];
|
||||
|
||||
url += ids.join('%2C');
|
||||
|
||||
var response = await http.get(Uri.parse(url), headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
});
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
Map<String, dynamic> responseData = jsonDecode(response.body);
|
||||
return List<Music>.from(responseData['tracks'].map((track) {
|
||||
return _getMusicFromResponse(track);
|
||||
}));
|
||||
} else {
|
||||
throw Exception(
|
||||
'Error while retrieving music : ${response.statusCode} ${response.reasonPhrase}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,111 +1,118 @@
|
||||
name: justmusic
|
||||
description: A new Flutter project.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: ^0.13.5
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
google_fonts: ^4.0.4
|
||||
gradiantbutton: ^0.0.1
|
||||
smooth_corner: ^1.1.0
|
||||
flutter_signin_button: ^2.0.0
|
||||
flutter_screenutil: ^5.7.0
|
||||
auto_size_text: ^3.0.0
|
||||
gradient_borders: ^1.0.0
|
||||
text_scroll: ^0.2.0
|
||||
circular_reveal_animation: ^2.0.1
|
||||
zoom_tap_animation: ^1.1.0
|
||||
custom_draggable_widget: ^0.0.2
|
||||
modal_bottom_sheet: ^2.1.2
|
||||
flutter_animated_play_button: ^0.3.0
|
||||
audioplayers: ^4.1.0
|
||||
ionicons: ^0.2.2
|
||||
top_snackbar_flutter: ^3.1.0
|
||||
firebase_core: ^2.15.0
|
||||
firebase_auth: ^4.7.2
|
||||
cloud_firestore: ^4.8.4
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- assets/images/
|
||||
- assets/
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
name: justmusic
|
||||
description: A new Flutter project.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.2 <3.0.0'
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: ^0.13.5
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
google_fonts: ^4.0.4
|
||||
gradiantbutton: ^0.0.1
|
||||
smooth_corner: ^1.1.0
|
||||
flutter_signin_button: ^2.0.0
|
||||
flutter_screenutil: ^5.7.0
|
||||
auto_size_text: ^3.0.0
|
||||
gradient_borders: ^1.0.0
|
||||
text_scroll: ^0.2.0
|
||||
circular_reveal_animation: ^2.0.1
|
||||
zoom_tap_animation: ^1.1.0
|
||||
custom_draggable_widget: ^0.0.2
|
||||
modal_bottom_sheet: ^2.1.2
|
||||
flutter_animated_play_button: ^0.3.0
|
||||
audioplayers: ^4.1.0
|
||||
ionicons: ^0.2.2
|
||||
top_snackbar_flutter: ^3.1.0
|
||||
firebase_core: ^2.15.0
|
||||
firebase_auth: ^4.7.2
|
||||
cloud_firestore: ^4.8.4
|
||||
image_picker: ^1.0.1
|
||||
insta_image_viewer: ^1.0.2
|
||||
pinch_zoom: ^1.0.0
|
||||
smooth_list_view: ^1.0.4
|
||||
animated_appear: ^0.0.4
|
||||
geolocator: ^9.0.2
|
||||
tuple: ^2.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
assets:
|
||||
- assets/images/
|
||||
- assets/
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/custom-fonts/#from-packages
|
||||
|
@ -1,60 +1,83 @@
|
||||
import 'package:justmusic/model/Artist.dart';
|
||||
import 'package:justmusic/model/Music.dart';
|
||||
import 'package:justmusic/view_model/MusicViewModel.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
MusicViewModel musicVM = new MusicViewModel();
|
||||
Music m = await musicVM.getMusic('295SxdR1DqunCNwd0U767w');
|
||||
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
|
||||
print('\nMusics :');
|
||||
|
||||
List<Music> musics = await musicVM.getMusicsWithName('Shavkat');
|
||||
for (Music m in musics) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nMusics With Artist:');
|
||||
|
||||
List<Music> musics2 = await musicVM.getMusicsWithArtistName('jul');
|
||||
for (Music m in musics2) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nArtist with Name:');
|
||||
|
||||
Artist a = await musicVM.getArtistWithName('jul');
|
||||
print("id : ${a.id}, name : ${a.name}, image : ${a.image}");
|
||||
|
||||
print('\nArtists with Name:');
|
||||
|
||||
List<Artist> artists = await musicVM.getArtistsWithName('jul');
|
||||
for (Artist a in artists) {
|
||||
print("id : ${a.id}, name : ${a.name}, image : ${a.image}");
|
||||
}
|
||||
|
||||
print('\nTop Musics :');
|
||||
|
||||
List<Music> topMusics = await musicVM.getTopMusicsWithArtistId('3NH8t45zOTqzlZgBvZRjvB');
|
||||
for (Music m in topMusics) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
import 'package:justmusic/model/Artist.dart';
|
||||
import 'package:justmusic/model/Music.dart';
|
||||
import 'package:justmusic/view_model/MusicViewModel.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
MusicViewModel musicVM = new MusicViewModel();
|
||||
Music m = await musicVM.getMusic('295SxdR1DqunCNwd0U767w');
|
||||
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
|
||||
print('\nMusics :');
|
||||
|
||||
List<Music> musics = await musicVM.getMusicsWithName('Shavkat');
|
||||
for (Music m in musics) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nMusics With Artist:');
|
||||
|
||||
List<Music> musics2 = await musicVM.getMusicsWithArtistName('jul');
|
||||
for (Music m in musics2) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nArtist with Name:');
|
||||
|
||||
Artist a = await musicVM.getArtistWithName('jul');
|
||||
print("id : ${a.id}, name : ${a.name}, image : ${a.image}");
|
||||
|
||||
print('\nArtists with Name:');
|
||||
|
||||
List<Artist> artists = await musicVM.getArtistsWithName('jul');
|
||||
for (Artist a in artists) {
|
||||
print("id : ${a.id}, name : ${a.name}, image : ${a.image}");
|
||||
}
|
||||
|
||||
print('\nTop Musics :');
|
||||
|
||||
List<Music> topMusics = await musicVM.getTopMusicsWithArtistId('3NH8t45zOTqzlZgBvZRjvB');
|
||||
for (Music m in topMusics) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nPlaylist Musics :');
|
||||
|
||||
List<Music> playlistMusics = await musicVM.getMusicsWithPlaylistId('37i9dQZF1DX1X23oiQRTB5');
|
||||
for (Music m in playlistMusics) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
print('\nMusics With Ids :');
|
||||
|
||||
List<Music> musicsIds = await musicVM.getMusicsWithIds(['6D1HiF2e3Z0F8FwQ5uLxwn','6IGg7qsBvA5xbrwz3MNHWK']);
|
||||
for (Music m in musicsIds) {
|
||||
print("id : ${m.id.toString()}, cover : ${m.cover}, title : ${m.title}");
|
||||
print("date : ${m.date.toString()}, preview : ${m.previewUrl}, duration : ${m.duration}, explicit : ${m.explicit}");
|
||||
for (Artist a in m.artists) {
|
||||
print("id : ${a.id}, name : ${a.name}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue