This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResponsiveExample extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.grey[350], | |
appBar: AppBar( | |
title: Text('Responsive Example'), | |
centerTitle: true, | |
), | |
body: Container( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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, | |
); | |
_scaffoldKey.currentState.showSnackBar(snackBar); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
error_reporting(E_ALL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webView.setDownloadListener(new DownloadListener() { | |
@Override | |
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimeType, long contentLength) { | |
DownloadManager.Request request = new | |
DownloadManager.Request(Uri.parse(url)); | |
request.setMimeType(mimeType); | |
//------------------------COOKIE!!------------------------ | |
String cookies = CookieManager.getInstance().getCookie(url); | |
request.addRequestHeader("cookie", cookies); |
NewerOlder