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