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:

https://github.com/stasheq/kotlin_cmd_exec

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.exitProcess
object 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) …

Scaling whole app

Starting from the most internal part:

  • SizedBox, to hard code a logical dimensions of the area that will be used by a child widget.
  • FittedBox, to scale its child to entirely fit the parent, maintaining its proportions.
  • Container, to set the background color of unused parts of the screen.
  • SizedBox.expand, to scale the background container to fit the whole screen.
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, …


version 2 with Kotlin

In short:

  • Create a service account and get its authorization data json file.
  • Make a script uses above json and Google Play Developer API to perform actions on your account.

Prerequisites:

  • You can login as an owner of a Google Play Account.
  • You can make Kotlin code. Android Studio is good enough. You can create a pure Kotlin non-Android module and then run it.

Step 1. Create a service account and get access keys json file

  • Open Google Play console. Go to “Settings” > “Developer account” > “API access”.
  • In “Service Accounts” section, choose “Create Service Account”.
  • You will be sent to “Google Cloud Plaform” console. Continue creating account there.
  • Give it a…

Paweł Szymański

Android developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store