Android and iOS both have a system setting to make texts bigger or smaller in general. Flutter takes it into account. It uses it by default.
Get the value “textScaleFactor” using MediaQuery
MediaQuery.of(context).textScaleFactor
https://api.flutter.dev/flutter/widgets/MediaQuery-class.html
In case if you want to turn this mechanism off, or change scaling value for a part of your app, wrap it in your own MediaQuery object.
Widget build(BuildContext context) {
double myOwnScaleFactor = 1.0;
return MediaQuery(
child: Container(), // your app, or part of it
data: MediaQuery.of(context).copyWith(textScaleFactor: myOwnScaleFactor),
);
}
Unix bash scripts, Windows batch scripts — hard to manage for a Kotlin programmer.
Kscript has it’s issues: it’s not the same as Kotlin, hard to debug, different method of adding imports than standard Kotlin etc.
Happily you can make a simple command line Kotlin app.
Full example available here:
gradle.kts
plugins {
id("kotlin")
id("application")
}application {
mainClassName = "me.szymanski.kotlinexec.example.Main"
}dependencies {
implementation("me.szymanski.kotlinexec:kotlin-exec-lib:1.0")
}
Main.kt
import me.szymanski.kotlinexec.exec
import java.lang.Exception
import kotlin.system.exitProcessobject Main {
@JvmStatic
fun main(args: Array<String>) {
try {
println("Received arguments: ${args.joinToString(", ")}")
"echo \"Hello world\"".exec()
} catch (e: Exception) {
e.printStackTrace()
println(e.message) …
Starting from the most internal part:
class ScalingBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
double logicWidth = 600;
double logicHeight = 600;
return SizedBox.expand(
child: Container(
color: Colors.blueGrey,
child: FittedBox(
fit: BoxFit.contain,
alignment: Alignment.center, …
In short:
Android developer