Skip to content

Instantly share code, notes, and snippets.

View pradeeprjth's full-sized avatar
🎯
Focusing

Pradeep pradeeprjth

🎯
Focusing
  • Cotocus.com
View GitHub Profile
console.clear()
var mFriends = ['Shaw', 'Clara', 'Vab', 'Kun', 'Jacob', 'Dina']
mFriends.splice(3, 0, 'Donna', 'Rachel')
// 1st tells where to start
// 2nd tells how many items to be deleted
// 3rd and 4th and so on tells what items to be added
console.log(mFriends)
class MyBottomNavigationButton extends StatefulWidget {
@override
_MyBottomNavigationButtonState createState() =>
_MyBottomNavigationButtonState();
}
class _MyBottomNavigationButtonState extends State<MyBottomNavigationButton> {
int _currentIndex = 0;
final List<Widget> _children = [
MyHomePage(),
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Professnow',
home: MyBottomNavigationButton(),
routes: <String, WidgetBuilder>{
'/home': (BuildContext context) => Homepage(),
'/profile': (BuildContext context) => Profile(),
'/account': (BuildContext context) => Account(),
// This method will be initialised by our script call-back
function initAutocomplete() {
$('form').on('keyup keypress', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});
// here we are getting the input keywords in locationInput constant
// getAddress method will get the current let long using feolocation that is provided by HTML
function getAddress() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
// here we are setting the value of two hidden input fields with the current let long;
function showPosition(position) {
$(document).on('click', '.ratenowbutton', function() {
$("#ratingModel").modal();
rating();
});
var ratedIndex = -1;
function rating(){
localStorage.removeItem('ratedIndex');
resetStarColors();
if(localStorage.getItem('ratedIndex') != null)
setStars(parseInt(localStorage.getItem('ratedIndex')));
<div class="modal fade" id="ratingModel" tabindex="-1" role="dialog" aria-labelledby="ratingModel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
// before rendering your main page use write a condition
var connectivityResult = await (Connectivity().checkConnectivity());
if (connectivityResult == ConnectivityResult.mobile) {
// this will show when your device is connected with mobile network
print("connected to mobile data");
// ignore: unused_local_variable
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('Connected to mobile network'),
backgroundColor: Colors.green,
bool isLoggedIn = false;
void onLoginStatusChanged(bool isLoggedIn) {
setState(() {
this.isLoggedIn = isLoggedIn;
});
}
@override
Widget build(BuildContext context) {
void initiateFacebookLogin() async {
var facebookLogin = FacebookLogin();
var facebookLoginResult =
await facebookLogin.logInWithReadPermissions(['email']);
switch (facebookLoginResult.status) {
case FacebookLoginStatus.error:
print("Error");
onLoginStatusChanged(false);
break;
case FacebookLoginStatus.cancelledByUser: