Skip to content

Instantly share code, notes, and snippets.

@ffkev
ffkev / main.dart
Last active April 11, 2024 06:00
There is a MediaQuery property in Flutter which you can use to restrict scaling of your fonts on different devices based on the device accessibility settings.
MediaQuery(
// This will set scaling for the app to always remain 1:1 globally
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(1.0)),
// Wrap your Material App with MediaQuery to implement this
child: MaterialApp.router(
title: 'ScaleFactorText',
...
),
);
@ffkev
ffkev / tool_tip_page.dart
Last active May 15, 2024 09:57
Tooltip auto dismiss implementation
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';
import 'package:aligned_tooltip/aligned_tooltip.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'home_page_model.dart';
export 'home_page_model.dart';
@ffkev
ffkev / encrypt_with_aes_nonce.dart
Created February 1, 2024 06:57
Custom Action implementation to encrypt a payload sent to the API
import 'dart:convert';
import 'package:encrypt/encrypt.dart' as en;
Future<String> encryptWithAesNonce(
dynamic jsonPayload,
String aesKeyString,
String nonceKeyString,
) async {
try {