add Change feed displayed

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

@ -135,6 +135,13 @@
</list>
</value>
</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">
<value>
<list>
@ -303,6 +310,13 @@
</list>
</value>
</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">
<value>
<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/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/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_parser-4.0.2/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/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/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/vector_math-2.1.2/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_screenutil/flutter_screenutil.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 {
const PostComponent({Key? key}) : super(key: key);
@ -57,31 +59,30 @@ class PostComponent extends StatelessWidget {
),
],
),
Container(
margin: EdgeInsets.only(top: 10),
SizedBox(height: 10),
AspectRatio(
aspectRatio: 1 / 1,
child: Container(
width: 300,
height: 300,
decoration: BoxDecoration(
// add border
border: const GradientBoxBorder(
gradient: LinearGradient(colors: [
Colors.transparent,
Color(0xFF323232),
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
width: 2.5,
),
// set border radius
borderRadius: BorderRadius.circular(20),
boxShadow: const [
BoxShadow(
color: Color(0xFF3A3A3A),
spreadRadius: 0.5,
blurRadius: 0,
offset: Offset(0, 0), // changes position of shadow
),
],
),
child: AspectRatio(
aspectRatio: 1 / 1,
child: Padding(
padding: EdgeInsets.all(1.5),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Container(
height: 20,
width: double.infinity,
borderRadius: BorderRadius.circular(18),
// implement image
child: Stack(
alignment: Alignment.bottomCenter,
children: const [
children: [
Image(
image: AssetImage("assets/images/exemple_cover.png"),
fit: BoxFit.cover,
@ -89,12 +90,22 @@ class PostComponent extends StatelessWidget {
),
Image(
image: AssetImage("assets/images/shadow_post.png"),
fit: BoxFit.cover,
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,28 +113,49 @@ class PostComponent extends StatelessWidget {
SizedBox(height: 10),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AutoSizeText(
Flexible(
flex: 6,
child: TextScroll(
"BOOBA",
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 26.sp),
maxFontSize: 30,
),
mode: TextScrollMode.endless,
pauseBetween: Duration(milliseconds: 500),
velocity: Velocity(pixelsPerSecond: Offset(20, 0)),
)),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: AutoSizeText(
padding: EdgeInsets.only(bottom: 10, right: 7, left: 7),
child: ClipOval(
child: Container(
width: 5.sp,
height: 5.sp,
color: Colors.white,
),
),
),
Expanded(
flex: 8,
child: Padding(
padding: EdgeInsets.only(bottom: 2),
child: TextScroll(
"A.C. Milan",
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,
fontWeight: FontWeight.w300,
fontSize: 16.sp),
maxFontSize: 20,
),
mode: TextScrollMode.endless,
velocity: Velocity(pixelsPerSecond: Offset(50, 20)),
pauseBetween: Duration(milliseconds: 500),
),
Expanded(
child: AutoSizeText(
)),
Container(width: 10),
AutoSizeText(
"2013",
style: GoogleFonts.plusJakartaSans(
color: Colors.white.withOpacity(0.5),
@ -132,7 +164,6 @@ class PostComponent extends StatelessWidget {
textAlign: TextAlign.end,
maxFontSize: 20,
),
)
],
),
SizedBox(height: 60),

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

@ -14,6 +14,35 @@ class FeedScreen extends StatefulWidget {
}
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
Widget build(BuildContext context) {
return Scaffold(
@ -36,12 +65,7 @@ class _FeedScreenState extends State<FeedScreen> {
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostComponent(),
PostComponent(),
PostComponent(),
PostComponent(),
],
children: displayFeed,
),
)),
),
@ -66,7 +90,7 @@ class _FeedScreenState extends State<FeedScreen> {
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 800),
child: const TopNavBarComponent(),
child: TopNavBarComponent(callback: changeFeed),
),
),
],

@ -130,6 +130,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -296,6 +303,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:

@ -42,6 +42,8 @@ dependencies:
flutter_signin_button: ^2.0.0
flutter_screenutil: ^5.7.0
auto_size_text: ^3.0.0
gradient_borders: ^1.0.0
text_scroll: ^0.2.0
dev_dependencies:
flutter_test:

Loading…
Cancel
Save