flutter 输入

37 阅读1分钟

单行输入

TextField(
  style: TextStyle(fontSize: 10),
  onChanged: (value) {},
  decoration: InputDecoration(
    hintText: "Your name",
    hintStyle: TextStyle(fontSize: 10),
    contentPadding: EdgeInsets.symmetric(
      horizontal: 16,
      vertical: 14,
    ),
    border: InputBorder.none,
  ),
),

多行输入

TextField(
  minLines: 2,
  maxLines: null,
  style: TextStyle(fontSize: 10),
  keyboardType: TextInputType.multiline,
  decoration: InputDecoration(
    hintText:
        "Please let us know what car brand/ your location/ number of cars you need etc.",
    isDense: true,
    alignLabelWithHint: true,
    hintStyle: TextStyle(fontSize: 10),
    contentPadding: EdgeInsets.symmetric(
      horizontal: 8,
      vertical: 3,
    ),
    border: InputBorder.none,
  ),
),