Skip to content

Instantly share code, notes, and snippets.


Bharathraj bharathraj-e

View GitHub Profile
bharathraj-e / main.dart
Last active May 22, 2022
Expansion panel - single expanded
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
View blockquote-basic.dart
'Lorem ipsum dolor sit amet, is the best place to hide a text.',
textAlign: TextAlign.justify,
View blockquote-options.dart
outerPadding: const EdgeInsets.all(20),
blockColor: Colors.blueAccent,
blockWidth: 5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
'Lorem ipsum dolor sit amet, is the best place to hide a text.',
textAlign: TextAlign.justify,
bharathraj-e / db-crud.php
Last active Aug 25, 2020
PHP DB CRUD CLASS - API Based Structure
View db-crud.php
require_once __DIR__ . '/response.php';
require_once __DIR__ . '/db.php';
class CRUD
private $db;
public function __construct()
bharathraj-e / check-request.php
Created Mar 29, 2020
Check request and finalize response
View check-request.php
function err($err)
$res['state'] = false;
$res['err'] = $err;
echo json_encode($res);
View permission.dart
import 'package:permission_handler/permission_handler.dart';
() async {
PermissionStatus p = await PermissionHandler()
if (p == PermissionStatus.disabled) {
// permission got already / success
return true;
bharathraj-e / date_format.dart
Created Feb 1, 2020
date picker and date to user readable string
View date_format.dart
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
Future<DateTime> fetchDate(BuildContext context,
{DateTime initialDate, DateTime last}) async {
DateTime t = await showDatePicker(
context: context,
firstDate: DateTime( - 1),
initialDate: initialDate ??,
lastDate: last ?? DateTime( + 2),
bharathraj-e / request.dart
Last active Sep 15, 2020
Flutter http request simplified
View request.dart
import 'dart:convert';
import 'package:http/http.dart' as http;
const String _host = "https://<....>";
class MyRequest {
final String url;
final Map<String, String> headers = {'Authorization': 'Bearer token'};
View responsive_ui_demo.dart
class ResponsiveExample extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[350],
appBar: AppBar(
title: Text('Responsive Example'),
centerTitle: true,
body: Container(
bharathraj-e / snacky-bar.dart
Created Jan 11, 2020
A function to create snackbar in flutter
View snacky-bar.dart
//final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
snackyBar(String content, GlobalKey<ScaffoldState> _scaffoldKey) {
final snackBar = SnackBar(
content: Text(content),
duration: const Duration(seconds: 2),
backgroundColor: Colors.lightBlue,