How can I increase the size of the container without affecting the flow?


usbToaster

I have this custom keyboard:custom keyboard

When a key is pressed, I want it to increase in size without affecting the position of other keys around it.

The structure of the keyboard is as follows:

keyboard_key.dart:

return GestureDetector(
  onTapDown: _handleOnTapDown,
  onTapUp: _handleOnTapUp,
  onTapCancel: _handleOnTapCancel,
  child: Container(
    height: keyHeight,
    width: keyWidth,
    margin: EdgeInsets.all(keySpacing),
    decoration: _boxDecoration(),
    child: Center(
      child: Text(
        letter,
        style: _textStyle(),
      ),
    ),
  ),
);

keyboard_row.dart:

return Container(
  child: Row(
    mainAxisAlignment: MainAxisAlignment.center,
    children: rowLetters.split('').map<Widget>((String ch) {
      return KeyboardKey(ch);
    }).toList(),
  ),
);

keyboard.dart:

return Container(
  padding: EdgeInsets.only(
    left: 1.0,
    right: 1.0,
    top: 8.0,
  ),
  child: Column(
    children: _rows.map<Widget>((row) => KeyboardRow(row)).toList(),
  ),
);
Stefano A.

You can scale using the Transform.scale Widget constructor child Widget:

// keyboard_key.dart
return GestureDetector(
  onTapDown: _handleOnTapDown,
  onTapUp: _handleOnTapUp,
  onTapCancel: _handleOnTapCancel,
  child: Transform.scale(
     scale: 1.5,
     child:
        Container(
          height: keyHeight,
          width: keyWidth,
          margin: EdgeInsets.all(keySpacing),
          decoration: _boxDecoration(),
          child: Center(
            child: Text(
              letter,
              style: _textStyle(),
       ),
     ),
   ),
);

Related


How can I add padding without affecting the container?

Ralph I'm redesigning the login page of an open source software ( Fedena ) . These are my changes . As you can see, I have used a background icon in the username/password fields. Currently, the text entered into the field overlaps the icon, and I'm looking for

How can I add padding without affecting the container?

Ralph I'm redesigning the login page of an open source software ( Fedena ) . These are my changes . As you can see, I have used a background icon in the username/password fields. Currently, the text entered into the field overlaps the icon, and I'm looking for

Increase input font size without affecting padding

User 13327953 I have an input text field filled with 1rem. I am trying to increase the font size to 1rem without affecting the input field size. The field must remain at the same height. Any suggestions? my HTML: <input type="text" class="search" placeholder="

How can I increase the size of this partition?

from you (SS from Ubuntu 18.04, gparted.) I have Windows, Ubuntu and Mint installed. Ubuntu has 200 GB and Mint has 100 GB. I wanted to reverse it, so when I was at Mint, I resized the partition containing Ubuntu( sda8) and lowered it to 112GB, and now I have

HTML/CSS: Increase border size without affecting height

ar099968 I have a table with a border of 1px at the bottom of each column. On row hover I want to set the border to 2px, see example: tr td { border-bottom: 1px solid grey; } tr:hover td { border-bottom: 2px solid red; } <table> <tr><td>foo</td><td>bar

HTML/CSS: Increase border size without affecting height

ar099968 I have a table with a border of 1px at the bottom of each column. On row hover I want to set the border to 2px, see example: tr td { border-bottom: 1px solid grey; } tr:hover td { border-bottom: 2px solid red; } <table> <tr><td>foo</td><td>bar

HTML/CSS: Increase border size without affecting height

ar099968 I have a table with a border of 1px at the bottom of each column. On row hover I want to set the border to 2px, see example: tr td { border-bottom: 1px solid grey; } tr:hover td { border-bottom: 2px solid red; } <table> <tr><td>foo</td><td>bar

HTML/CSS: Increase border size without affecting height

ar099968 I have a table with a border of 1px at the bottom of each column. On row hover I want to set the border to 2px, see example: tr td { border-bottom: 1px solid grey; } tr:hover td { border-bottom: 2px solid red; } <table> <tr><td>foo</td><td>bar

HTML/CSS: Increase border size without affecting height

ar099968 I have a table with a border of 1px at the bottom of each column. On row hover I want to set the border to 2px, see example: tr td { border-bottom: 1px solid grey; } tr:hover td { border-bottom: 2px solid red; } <table> <tr><td>foo</td><td>bar