mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-03-06 08:36:36 +00:00
Remove unneccesary Container instances
This commit is contained in:
parent
2b844d27dd
commit
f3be26d136
2 changed files with 78 additions and 80 deletions
|
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:mobile_nebula/components/SpecialTextField.dart';
|
import 'package:mobile_nebula/components/SpecialTextField.dart';
|
||||||
import 'package:mobile_nebula/models/CIDR.dart';
|
import 'package:mobile_nebula/models/CIDR.dart';
|
||||||
|
|
||||||
import '../services/utils.dart';
|
import '../services/utils.dart';
|
||||||
import 'IPField.dart';
|
import 'IPField.dart';
|
||||||
|
|
||||||
|
@ -52,57 +53,55 @@ class _CIDRFieldState extends State<CIDRField> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var textStyle = CupertinoTheme.of(context).textTheme.textStyle;
|
var textStyle = CupertinoTheme.of(context).textTheme.textStyle;
|
||||||
|
|
||||||
return Container(
|
return Row(
|
||||||
child: Row(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
Expanded(
|
child: Padding(
|
||||||
child: Padding(
|
padding: EdgeInsets.fromLTRB(6, 6, 2, 6),
|
||||||
padding: EdgeInsets.fromLTRB(6, 6, 2, 6),
|
child: IPField(
|
||||||
child: IPField(
|
help: widget.ipHelp,
|
||||||
help: widget.ipHelp,
|
ipOnly: true,
|
||||||
ipOnly: true,
|
textPadding: EdgeInsets.all(0),
|
||||||
textPadding: EdgeInsets.all(0),
|
textInputAction: TextInputAction.next,
|
||||||
textInputAction: TextInputAction.next,
|
textAlign: TextAlign.end,
|
||||||
textAlign: TextAlign.end,
|
focusNode: widget.focusNode,
|
||||||
focusNode: widget.focusNode,
|
nextFocusNode: bitsFocus,
|
||||||
nextFocusNode: bitsFocus,
|
|
||||||
onChanged: (val) {
|
|
||||||
if (widget.onChanged == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cidr.ip = val;
|
|
||||||
widget.onChanged!(cidr);
|
|
||||||
},
|
|
||||||
controller: widget.ipController,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text("/"),
|
|
||||||
Container(
|
|
||||||
width: Utils.textSize("bits", textStyle).width + 12,
|
|
||||||
padding: EdgeInsets.fromLTRB(2, 6, 6, 6),
|
|
||||||
child: SpecialTextField(
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
focusNode: bitsFocus,
|
|
||||||
nextFocusNode: widget.nextFocusNode,
|
|
||||||
controller: widget.bitsController,
|
|
||||||
onChanged: (val) {
|
onChanged: (val) {
|
||||||
if (widget.onChanged == null) {
|
if (widget.onChanged == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cidr.bits = int.tryParse(val) ?? 0;
|
cidr.ip = val;
|
||||||
widget.onChanged!(cidr);
|
widget.onChanged!(cidr);
|
||||||
},
|
},
|
||||||
maxLength: 2,
|
controller: widget.ipController,
|
||||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
|
||||||
textInputAction: widget.textInputAction ?? TextInputAction.done,
|
|
||||||
placeholder: 'bits',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
Text("/"),
|
||||||
|
Container(
|
||||||
|
width: Utils.textSize("bits", textStyle).width + 12,
|
||||||
|
padding: EdgeInsets.fromLTRB(2, 6, 6, 6),
|
||||||
|
child: SpecialTextField(
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
focusNode: bitsFocus,
|
||||||
|
nextFocusNode: widget.nextFocusNode,
|
||||||
|
controller: widget.bitsController,
|
||||||
|
onChanged: (val) {
|
||||||
|
if (widget.onChanged == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cidr.bits = int.tryParse(val) ?? 0;
|
||||||
|
widget.onChanged!(cidr);
|
||||||
|
},
|
||||||
|
maxLength: 2,
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
|
textInputAction: widget.textInputAction ?? TextInputAction.done,
|
||||||
|
placeholder: 'bits',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:mobile_nebula/components/SpecialTextField.dart';
|
import 'package:mobile_nebula/components/SpecialTextField.dart';
|
||||||
import 'package:mobile_nebula/models/IPAndPort.dart';
|
import 'package:mobile_nebula/models/IPAndPort.dart';
|
||||||
|
|
||||||
import '../services/utils.dart';
|
import '../services/utils.dart';
|
||||||
import 'IPField.dart';
|
import 'IPField.dart';
|
||||||
|
|
||||||
|
@ -58,49 +59,47 @@ class _IPAndPortFieldState extends State<IPAndPortField> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var textStyle = CupertinoTheme.of(context).textTheme.textStyle;
|
var textStyle = CupertinoTheme.of(context).textTheme.textStyle;
|
||||||
|
|
||||||
return Container(
|
return Row(
|
||||||
child: Row(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
Expanded(
|
child: Padding(
|
||||||
child: Padding(
|
padding: EdgeInsets.fromLTRB(6, 6, 2, 6),
|
||||||
padding: EdgeInsets.fromLTRB(6, 6, 2, 6),
|
child: IPField(
|
||||||
child: IPField(
|
help: widget.ipHelp,
|
||||||
help: widget.ipHelp,
|
ipOnly: widget.ipOnly,
|
||||||
ipOnly: widget.ipOnly,
|
nextFocusNode: _portFocus,
|
||||||
nextFocusNode: _portFocus,
|
textPadding: EdgeInsets.all(0),
|
||||||
textPadding: EdgeInsets.all(0),
|
textInputAction: TextInputAction.next,
|
||||||
textInputAction: TextInputAction.next,
|
focusNode: widget.focusNode,
|
||||||
focusNode: widget.focusNode,
|
|
||||||
onChanged: (val) {
|
|
||||||
_ipAndPort.ip = val;
|
|
||||||
widget.onChanged(_ipAndPort);
|
|
||||||
},
|
|
||||||
textAlign: widget.ipTextAlign,
|
|
||||||
controller: widget.ipController,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(":"),
|
|
||||||
Container(
|
|
||||||
width: Utils.textSize("00000", textStyle).width + 12,
|
|
||||||
padding: EdgeInsets.fromLTRB(2, 6, 6, 6),
|
|
||||||
child: SpecialTextField(
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
focusNode: _portFocus,
|
|
||||||
nextFocusNode: widget.nextFocusNode,
|
|
||||||
controller: widget.portController,
|
|
||||||
onChanged: (val) {
|
onChanged: (val) {
|
||||||
_ipAndPort.port = int.tryParse(val);
|
_ipAndPort.ip = val;
|
||||||
widget.onChanged(_ipAndPort);
|
widget.onChanged(_ipAndPort);
|
||||||
},
|
},
|
||||||
maxLength: 5,
|
textAlign: widget.ipTextAlign,
|
||||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
controller: widget.ipController,
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
placeholder: 'port',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
Text(":"),
|
||||||
|
Container(
|
||||||
|
width: Utils.textSize("00000", textStyle).width + 12,
|
||||||
|
padding: EdgeInsets.fromLTRB(2, 6, 6, 6),
|
||||||
|
child: SpecialTextField(
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
focusNode: _portFocus,
|
||||||
|
nextFocusNode: widget.nextFocusNode,
|
||||||
|
controller: widget.portController,
|
||||||
|
onChanged: (val) {
|
||||||
|
_ipAndPort.port = int.tryParse(val);
|
||||||
|
widget.onChanged(_ipAndPort);
|
||||||
|
},
|
||||||
|
maxLength: 5,
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
placeholder: 'port',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue