add Change feed displayed

pull/14/head
Lucas Delanier 2 years ago
parent e2a13215c0
commit bd45fad9ce

@ -135,6 +135,13 @@
</list> </list>
</value> </value>
</entry> </entry>
<entry key="gradient_borders">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/gradient_borders-1.0.0/lib" />
</list>
</value>
</entry>
<entry key="http"> <entry key="http">
<value> <value>
<list> <list>
@ -303,6 +310,13 @@
</list> </list>
</value> </value>
</entry> </entry>
<entry key="text_scroll">
<value>
<list>
<option value="$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/text_scroll-0.2.0/lib" />
</list>
</value>
</entry>
<entry key="typed_data"> <entry key="typed_data">
<value> <value>
<list> <list>
@ -351,6 +365,7 @@
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/font_awesome_flutter-9.2.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/google_fonts-4.0.4/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/google_fonts-4.0.4/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/gradiantbutton-0.0.1/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/gradiantbutton-0.0.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/gradient_borders-1.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http-0.13.5/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http-0.13.5/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http_parser-4.0.2/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/http_parser-4.0.2/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/lints-2.0.1/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/lints-2.0.1/lib" />
@ -374,6 +389,7 @@
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.1.1/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.1.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.2.1/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.2.1/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/test_api-0.4.12/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/test_api-0.4.12/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/text_scroll-0.2.0/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.3.2/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.3.2/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.1.2/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.1.2/lib" />
<root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-4.1.4/lib" /> <root url="file://$USER_HOME$/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/win32-4.1.4/lib" />

@ -3,6 +3,8 @@ 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:gradient_borders/box_borders/gradient_box_border.dart';
import 'package:text_scroll/text_scroll.dart';
class PostComponent extends StatelessWidget { class PostComponent extends StatelessWidget {
const PostComponent({Key? key}) : super(key: key); const PostComponent({Key? key}) : super(key: key);
@ -57,44 +59,53 @@ class PostComponent extends StatelessWidget {
), ),
], ],
), ),
Container( SizedBox(height: 10),
margin: EdgeInsets.only(top: 10), AspectRatio(
decoration: BoxDecoration( aspectRatio: 1 / 1,
borderRadius: BorderRadius.circular(20), child: Container(
boxShadow: const [ width: 300,
BoxShadow( height: 300,
color: Color(0xFF3A3A3A), decoration: BoxDecoration(
spreadRadius: 0.5, // add border
blurRadius: 0, border: const GradientBoxBorder(
offset: Offset(0, 0), // changes position of shadow gradient: LinearGradient(colors: [
Colors.transparent,
Color(0xFF323232),
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
width: 2.5,
), ),
], // set border radius
), borderRadius: BorderRadius.circular(20),
child: AspectRatio( ),
aspectRatio: 1 / 1, child: ClipRRect(
child: Padding( borderRadius: BorderRadius.circular(18),
padding: EdgeInsets.all(1.5), // implement image
child: ClipRRect( child: Stack(
borderRadius: BorderRadius.circular(20), alignment: Alignment.bottomCenter,
child: Container( children: [
height: 20, Image(
width: double.infinity, image: AssetImage("assets/images/exemple_cover.png"),
child: Stack( fit: BoxFit.cover,
alignment: Alignment.bottomCenter, width: double.infinity,
children: const [
Image(
image: AssetImage("assets/images/exemple_cover.png"),
fit: BoxFit.cover,
width: double.infinity,
),
Image(
image: AssetImage("assets/images/shadow_post.png"),
fit: BoxFit.cover,
width: double.infinity,
),
],
), ),
), Image(
image: AssetImage("assets/images/shadow_post.png"),
fit: BoxFit.fitHeight,
width: double.infinity,
),
Padding(
padding: EdgeInsets.all(15),
child: AutoSizeText(
'“Jécoute en boucle ce son. B2O<3”',
style: GoogleFonts.plusJakartaSans(
color: Colors.white,
fontWeight: FontWeight.w400,
fontSize: 15.sp),
maxFontSize: 20,
maxLines: 1,
),
)
],
), ),
), ),
), ),
@ -102,37 +113,57 @@ class PostComponent extends StatelessWidget {
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AutoSizeText( Flexible(
"BOOBA", flex: 6,
style: GoogleFonts.plusJakartaSans( child: TextScroll(
color: Colors.white, "BOOBA",
fontWeight: FontWeight.w600, style: GoogleFonts.plusJakartaSans(
fontSize: 26.sp), height: 1,
maxFontSize: 30, color: Colors.white,
), fontWeight: FontWeight.w600,
fontSize: 26.sp),
mode: TextScrollMode.endless,
pauseBetween: Duration(milliseconds: 500),
velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
)),
Padding( Padding(
padding: const EdgeInsets.only(left: 15.0), padding: EdgeInsets.only(bottom: 10, right: 7, left: 7),
child: AutoSizeText( child: ClipOval(
"A.C. Milan", child: Container(
style: GoogleFonts.plusJakartaSans( width: 5.sp,
color: Colors.white, height: 5.sp,
fontWeight: FontWeight.w300, color: Colors.white,
fontSize: 16.sp), ),
maxFontSize: 20,
), ),
), ),
Expanded( Expanded(
child: AutoSizeText( flex: 8,
"2013", child: Padding(
style: GoogleFonts.plusJakartaSans( padding: EdgeInsets.only(bottom: 2),
color: Colors.white.withOpacity(0.5), child: TextScroll(
fontWeight: FontWeight.w300, "A.C. Milan",
fontSize: 16.sp), style: GoogleFonts.plusJakartaSans(
textAlign: TextAlign.end, height: 1,
maxFontSize: 20, color: Colors.white,
), fontWeight: FontWeight.w300,
) fontSize: 16.sp),
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.sp),
textAlign: TextAlign.end,
maxFontSize: 20,
),
], ],
), ),
SizedBox(height: 60), SizedBox(height: 60),

@ -6,13 +6,21 @@ import 'package:google_fonts/google_fonts.dart';
import '../values/constants.dart'; import '../values/constants.dart';
class TopNavBarComponent extends StatefulWidget { class TopNavBarComponent extends StatefulWidget {
const TopNavBarComponent({Key? key}) : super(key: key); final Function(bool) callback;
const TopNavBarComponent({Key? key, required this.callback})
: super(key: key);
@override @override
State<TopNavBarComponent> createState() => _TopNavBarComponentState(); State<TopNavBarComponent> createState() => _TopNavBarComponentState();
} }
class _TopNavBarComponentState extends State<TopNavBarComponent> { class _TopNavBarComponentState extends State<TopNavBarComponent> {
bool choice = true;
void actionSurBouton() {
widget.callback(choice);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
@ -45,20 +53,66 @@ class _TopNavBarComponentState extends State<TopNavBarComponent> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AutoSizeText( GestureDetector(
"Mes amis", onTap: () {
style: GoogleFonts.plusJakartaSans( setState(() {
fontWeight: FontWeight.w300, choice = !choice;
fontSize: 16, actionSurBouton();
color: unactiveFeed), });
},
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints constraints) {
if (choice) {
return AutoSizeText(
"Mes amis",
style: GoogleFonts.plusJakartaSans(
fontWeight: FontWeight.w500,
fontSize: 16,
color: Colors.white),
);
} else {
return AutoSizeText(
"Mes amis",
style: GoogleFonts.plusJakartaSans(
fontWeight: FontWeight.w300,
fontSize: 16,
color: unactiveFeed),
);
}
},
),
),
GestureDetector(
onTap: () {
setState(() {
choice = !choice;
actionSurBouton();
});
},
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints constraints) {
if (choice) {
return AutoSizeText(
"Discovery",
style: GoogleFonts.plusJakartaSans(
fontWeight: FontWeight.w300,
fontSize: 16,
color: unactiveFeed),
);
} else {
return AutoSizeText(
"Discovery",
style: GoogleFonts.plusJakartaSans(
fontWeight: FontWeight.w500,
fontSize: 16,
color: Colors.white),
);
}
},
),
), ),
AutoSizeText(
"Discovery",
style: GoogleFonts.plusJakartaSans(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.white),
)
], ],
), ),
], ],

@ -14,6 +14,35 @@ class FeedScreen extends StatefulWidget {
} }
class _FeedScreenState extends State<FeedScreen> { class _FeedScreenState extends State<FeedScreen> {
List<PostComponent> friendFeed = [
PostComponent(),
PostComponent(),
PostComponent(),
];
List<PostComponent> discoveryFeed = [
PostComponent(),
];
late List<PostComponent> displayFeed;
@override
void initState() {
displayFeed = friendFeed;
super.initState();
}
void changeFeed(bool choice) {
// Mettez ici le code pour l'action que vous souhaitez effectuer avec le paramètre
if (choice) {
setState(() {
displayFeed = friendFeed;
});
} else {
setState(() {
displayFeed = discoveryFeed;
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -36,12 +65,7 @@ class _FeedScreenState extends State<FeedScreen> {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: displayFeed,
PostComponent(),
PostComponent(),
PostComponent(),
PostComponent(),
],
), ),
)), )),
), ),
@ -66,7 +90,7 @@ class _FeedScreenState extends State<FeedScreen> {
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 800), constraints: BoxConstraints(maxWidth: 800),
child: const TopNavBarComponent(), child: TopNavBarComponent(callback: changeFeed),
), ),
), ),
], ],

@ -130,6 +130,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1" version: "0.0.1"
gradient_borders:
dependency: "direct main"
description:
name: gradient_borders
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
http: http:
dependency: transitive dependency: transitive
description: description:
@ -296,6 +303,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.12" version: "0.4.12"
text_scroll:
dependency: "direct main"
description:
name: text_scroll
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

@ -42,6 +42,8 @@ dependencies:
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
text_scroll: ^0.2.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save