Flutter - how to change keyboard theme to dark?

Viewed 344

I use dark theme for app, but keyboard which appears with TextField has white background and dark numbers (used keyboard type: TextInputType.number). How to change keyboard theme to dark?

theme: ThemeData.dark().copyWith( ...

a minimal exaple

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text Field Demo',
      theme: ThemeData.dark().copyWith(
        // primaryColor: Colors.black,
        // primaryColorLight: Colors.black,
        primaryColorBrightness: Brightness.dark,
      ),
      home: const EquipmentView(),
    );
  }
}

class EquipmentView extends StatelessWidget {
  const EquipmentView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextField(
              autofocus: true,
              keyboardAppearance: Brightness.dark,
              onSubmitted: (value) {},
            ),
          ],
        ),
      ),
    );
  }
}

It seems it works on real phone and doesn't work on emulator.

0 Answers
Related