Skip to content

Commit

Permalink
feat: Add FloatingActionButton for that chat in HomePage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixel2004 committed Aug 11, 2023
1 parent 7350aed commit 7cc0554
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Binary file added scp/assets/chat.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 26 additions & 9 deletions scp/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,30 @@ class _HomePageState extends State<HomePage> {
child: CircularProgressIndicator(),
),
),
floatingActionButton:
(snap.connectionState != ConnectionState.waiting ||
snap.connectionState != ConnectionState.waiting)
? FloatingActionButton(
onPressed: () {
if (isChat) {
Navigator.pushNamed(context, Routes.rChat,
arguments: ChatArguments(chatUrl!));
}
},
child: Container(
margin: EdgeInsets.all(5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
image: DecorationImage(
image: AssetImage(
"assets/chat.gif",
),
fit: BoxFit.cover,
),
),
),
)
: null,
);
},
),
Expand Down Expand Up @@ -455,6 +479,7 @@ class _HomePageState extends State<HomePage> {
username = prefs.getString('username')!;
isAutumn = prefs.getBool('is_autumn');
rollNo = prefs.getString('roll_no')!;
// rollNo = '123CS1133';
phoneNo = prefs.getString('phone_no')!;
await prefs.setBool('hasBooked', prefs.getBool('hasBooked') ?? false);
debugPrint(username + rollNo + phoneNo + isAutumn.toString());
Expand Down Expand Up @@ -494,15 +519,7 @@ class _HomePageState extends State<HomePage> {

_launchUpdate() async {
if (await canLaunchUrl(playstoreUri)) {
await launchUrl(playstoreUri);
} else {
throw 'Could not launch $playstoreURL';
}
}

_launchURL() async {
if (await canLaunchUrl(playstoreUri)) {
await launchUrl(playstoreUri);
await launchUrl(playstoreUri, mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch $playstoreURL';
}
Expand Down

0 comments on commit 7cc0554

Please sign in to comment.