Skip to content

Instantly share code, notes, and snippets.

View bharathraj-e's full-sized avatar
🦊

Bharathraj bharathraj-e

🦊
View GitHub Profile
import 'package:flutter/material.dart';
class GameButton extends StatelessWidget {
const GameButton({required this.child, this.color, this.height = 56, this.width, required this.onTap, super.key});
final Widget child;
final Color? color;
final double height;
final double? width;
final VoidCallback onTap;
@bharathraj-e
bharathraj-e / jira-board.dart
Created April 12, 2023 18:26
Kanban board / jira borad basic ui in flutter
Scaffold(
appBar: AppBar(
title: const Text('Jira Board'),
),
body: Column(
children: [
Expanded(
child: Row(
children: [
Expanded(
@bharathraj-e
bharathraj-e / prefs.dart
Last active February 4, 2023 09:55
flutter shared preferences singleton shortcut for set and get
import 'package:shared_preferences/shared_preferences.dart';
class Prefs {
static SharedPreferences _prefs;
// call this method from iniState() function of mainApp().
static Future<SharedPreferences> init() async {
_prefs = await SharedPreferences.getInstance();
return _prefs;
@bharathraj-e
bharathraj-e / main.dart
Last active May 22, 2022 05:50
Expansion panel - single expanded
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';
@override
@bharathraj-e
bharathraj-e / request.dart
Last active September 15, 2020 08:55
Flutter http request simplified
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'};
BlockQuote(
child:
Text(
'Lorem ipsum dolor sit amet, is the best place to hide a text.',
textAlign: TextAlign.justify,
),
),
BlockQuote(
outerPadding: const EdgeInsets.all(20),
blockColor: Colors.blueAccent,
blockWidth: 5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Lorem ipsum dolor sit amet, is the best place to hide a text.',
textAlign: TextAlign.justify,
@bharathraj-e
bharathraj-e / db-crud.php
Last active August 25, 2020 05:14
PHP DB CRUD CLASS - API Based Structure
<?php
require_once __DIR__ . '/response.php';
require_once __DIR__ . '/db.php';
class CRUD
{
private $db;
public function __construct()
@bharathraj-e
bharathraj-e / json-decode.php
Last active July 13, 2020 05:17
decode json from file_get_contents(); ,with error displaying
function decodeJson($json, $assoc = false)
{
$json = preg_replace('/[\x00-\x1F\x7F]/u', '', $json);
$ret = json_decode($json, $assoc);
if ($error = json_last_error()) {
$errorReference = [
JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded.',
JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON.',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded.',
JSON_ERROR_SYNTAX => 'Syntax error.',
@bharathraj-e
bharathraj-e / check-request.php
Created March 29, 2020 06:01
Check request and finalize response
<?php
function err($err)
{
$res['state'] = false;
$res['err'] = $err;
echo json_encode($res);
die();
}