这是我在屏幕上显示的内容:
https://i.imgur.com/oSblgWD.png
如何对齐“姓氏”,使其在“名字”下? 我不想在姓氏旁边放一个图标,只是名字。
这是我的代码。谢谢。
body: Center(
child: Form(
key: _formKey,
child: Column(
children: <Widget>[
ListTile(
leading: const Icon(Icons.person),
title: new TextField(
decoration: new InputDecoration(
hintText: "First name",
),
),
),
ListTile(
title: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
],
),
)
)
答案 0 :(得分:1)
您可以将Container
固定宽度的空白leading
添加到姓氏TextField
中,也可以将姓氏TextField
包装在Padding
中并从左侧提供一些padding
。
示例:
ListTile(
leading: Container(
width: 200.0, //You can adjust the width as required
),
title: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
OR
ListTile(
title: Padding(
padding: padding: EdgeInsets.only(left: 200.0) //Adjust as required
child: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
),
答案 1 :(得分:1)
通过将图标颜色更改为colors.transparent可以快速破解。我不知道这是否是正确的方法。
body: Center(
child: Form(
key: _formKey,
child: Column(
children: <Widget>[
ListTile(
leading: const Icon(Icons.person),
title: new TextField(
decoration: new InputDecoration(
hintText: "First name",
),
),
),
ListTile(
leading: const Icon(Icons.person,color: Colors.transparent),
title: new TextField(
decoration: new InputDecoration(
hintText: "Last name",
),
),
),
],
),
)
)
答案 2 :(得分:1)
简单而优雅的方式是使用Result StackTrace:
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler.HandleAuthenticateAsync() in C:\local\identity\server4\AccessTokenValidation\src\IdentityServer4.AccessTokenValidation\IdentityServerAuthenticationHandler.cs:line 61
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\BaseUrlMiddleware.cs:line 36
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.TestHost.HttpContextBuilder.<>c__DisplayClass10_0.<<SendAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.TestHost.ClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at xxx.ClientControllerTest.CreateNewClientAsync() in xxx.ClientControllerTest.cs:line 167
at xxx.ClientControllerTest.CreateNewClientTest() in xxx\ControllerTests\ClientControllerTest.cs:line 47
--- End of stack trace from previous location where exception was thrown ---
----- Inner Stack Trace -----
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
----- Inner Stack Trace -----
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
----- Inner Stack Trace -----
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
Result Message:
System.InvalidOperationException : IDX20803: Unable to obtain configuration from: '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to reveal it.]'.
---- System.IO.IOException : IDX20804: Unable to retrieve document from: '[PII is hidden by default. Set the 'ShowPII' flag in IdentityModelEventSource.cs to true to reveal it.]'.
-------- System.Net.Http.HttpRequestException : No connection could be made because the target machine actively refused it
------------ System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it
小部件。
Padding