Skip to content

Commit

Permalink
add social_link widget, add developer page to home_drawer with name t…
Browse files Browse the repository at this point in the history
…eam and rename company.png to outlook.png
  • Loading branch information
ltkien0105 committed Sep 30, 2023
1 parent d4e287a commit f4e1443
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 13 deletions.
File renamed without changes
1 change: 1 addition & 0 deletions lib/pages/developer/developer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:onestop_dev/globals/my_colors.dart';
import 'package:onestop_dev/widgets/developer/developer_card.dart';

class DeveloperPage extends StatefulWidget {
static String id = '/developer';
const DeveloperPage({super.key});

@override
Expand Down
31 changes: 18 additions & 13 deletions lib/widgets/developer/developer_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import 'package:onestop_dev/globals/my_colors.dart';
import 'package:onestop_dev/globals/my_fonts.dart';
import 'package:onestop_dev/widgets/developer/social_link.dart';

class DeveloperCard extends StatelessWidget {
const DeveloperCard({
Expand Down Expand Up @@ -37,31 +38,35 @@ class DeveloperCard extends StatelessWidget {
const SizedBox(
height: 15,
),
Text(
developerName,
style: MyFonts.w500.size(14).setColor(kWhite)
),
Text(developerName, style: MyFonts.w500.size(14).setColor(kWhite)),
const SizedBox(
height: 5,
),
Text(
developerPosition,
style: MyFonts.w400.size(12).setColor(lBlue)
),
Text(developerPosition,
style: MyFonts.w400.size(12).setColor(lBlue)),
const SizedBox(
height: 15,
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Image.asset('assets/images/linkedin.png'),
Image.asset('assets/images/github.png'),
Image.asset('assets/images/company.png'),
SocialLink(
url: 'https://www.linkedin.com/',
imagePath: 'assets/images/linkedin.png'),
SocialLink(
url: 'https://github.com/',
imagePath: 'assets/images/github.png',
),
SocialLink(
url:
'https://outlook.live.com/',
imagePath: 'assets/images/outlook.png',
),
],
)
],
),
),
);
}
}
}
40 changes: 40 additions & 0 deletions lib/widgets/developer/social_link.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import 'package:flutter/material.dart';

import 'package:url_launcher/url_launcher.dart';

import 'package:onestop_dev/functions/utility/show_snackbar.dart';

class SocialLink extends StatelessWidget {
const SocialLink({
super.key,
required this.url,
required this.imagePath,
});

final String url;
final String imagePath;

@override
Widget build(BuildContext context) {
Future<void> launchURL(String url) async {
final Uri uri = Uri.parse(url);
if (!await launchUrl(
uri,
mode: LaunchMode.externalApplication,
)) {
throw "Can not launch url";
}
}

return GestureDetector(
onTap: () async {
try {
await launchURL(url);
} catch (e) {
showSnackBar(e.toString());
}
},
child: Image.asset(imagePath),
);
}
}
20 changes: 20 additions & 0 deletions lib/widgets/home/home_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:onestop_dev/functions/utility/phone_email.dart';
import 'package:onestop_dev/pages/developer/developer_page.dart';
import 'package:onestop_dev/pages/home/home.dart';
import 'package:onestop_dev/widgets/ui/appbar.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -129,6 +130,25 @@ class HomeDrawer extends StatelessWidget {
),
),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (buildContext) => const DeveloperPage(),
),
);
scaffoldKey.currentState!.closeDrawer();
},
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
child: Text(
"Team",
style: MyFonts.w400.size(14).setColor(kWhite),
),
),
),
Expanded(child: Container()),

SvgPicture.asset("assets/images/logo.svg"),
Expand Down

0 comments on commit f4e1443

Please sign in to comment.