Skip to content

Commit

Permalink
Floating Button
Browse files Browse the repository at this point in the history
  • Loading branch information
namritaansh02 committed Dec 29, 2023
1 parent 527a31f commit 8b5c302
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 58 deletions.
66 changes: 9 additions & 57 deletions lib/src/routes/blogpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,64 +298,16 @@ class _BlogPageState extends State<BlogPage> {
}

// Follow button widget
ElevatedButton _buildFollowBody(ThemeData theme, InstiAppBloc bloc) {
return ElevatedButton(
style: ElevatedButton.styleFrom(
primary: body?.bodyUserFollows ?? false
? theme.colorScheme.secondary
: theme.scaffoldBackgroundColor,
onPrimary: body?.bodyUserFollows ?? false
? theme.floatingActionButtonTheme.foregroundColor
: theme.textTheme.bodyText1?.color,
shape: RoundedRectangleBorder(
side: BorderSide(
color: theme.colorScheme.secondary,
),
borderRadius: BorderRadius.all(Radius.circular(4)),
),
FloatingActionButton _buildFollowBody(ThemeData theme, InstiAppBloc bloc) {
return FloatingActionButton.extended(
label: Text(
body?.bodyUserFollows ?? false ? "Following" : "Follow",
style: TextStyle(
color:
body?.bodyUserFollows ?? false ? Colors.white : Colors.black),
),
child: Row(children: () {
var rowChildren = <Widget>[
Text(
body?.bodyUserFollows ?? false ? "Following" : "Follow",
// style: TextStyle(color: Colors.black),
),
SizedBox(
width: 8.0,
),
body?.bodyFollowersCount != null
? Text("${body?.bodyFollowersCount}")
: SizedBox(
height: 18,
width: 18,
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(
body?.bodyUserFollows ?? false
? theme.floatingActionButtonTheme.foregroundColor!
: theme.colorScheme.secondary,
),
strokeWidth: 2,
)),
];
if (loadingFollow) {
rowChildren.insertAll(0, [
SizedBox(
height: 18,
width: 18,
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(
body?.bodyUserFollows ?? false
? theme.floatingActionButtonTheme.foregroundColor!
: theme.colorScheme.secondary),
strokeWidth: 2,
)),
SizedBox(
width: 8.0,
)
]);
}
return rowChildren;
}()),
backgroundColor:
body?.bodyUserFollows ?? false ? Colors.red : Colors.white,
onPressed: () async {
if (bloc.currSession == null) {
return;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/routes/externalblogpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class _ExternalBlogPageState extends State<ExternalBlogPage> {
}

Future<Body> dostuff() async {
final response = await http.get(Uri.parse(
// ignore: unused_local_variable
var response = await http.get(Uri.parse(
'https://gymkhana.iitb.ac.in/instiapp/api/bodies/8e303dca-9b2d-4501-bf7e-addca5e0c798'));
Body external_body =
await bloc.getBody("8e303dca-9b2d-4501-bf7e-addca5e0c798");
Expand Down
1 change: 1 addition & 0 deletions lib/src/routes/placementblogpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class _PlacementBlogPageState extends State<PlacementBlogPage> {
}

Future<Body> dostuff() async {
// ignore: unused_local_variable
final response = await http.get(Uri.parse(
'https://gymkhana.iitb.ac.in/instiapp/api/bodies/5023aff7-4407-4e75-95c9-5f691e8c3efb'));
Body placement_body =
Expand Down
1 change: 1 addition & 0 deletions lib/src/routes/trainingblogpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class _TrainingBlogPageState extends State<TrainingBlogPage> {
}

Future<Body> dostuff() async {
// ignore: unused_local_variable
final response = await http.get(Uri.parse(
'https://gymkhana.iitb.ac.in/instiapp/api/bodies/9cb8659c-bfdf-4e30-a2f0-057f86697123'));
Body internship_body =
Expand Down

0 comments on commit 8b5c302

Please sign in to comment.