Как отцентрировать текст по вертикали и горизонтали во флаттере?

Вы можете сделать это следующим образом:

@Test
public void testLoginWithCorrectUserNameAndPassword() throws Exception {
    // create or mock response object
    when(service.login(anyString(), anyString(), anyString).thenReturn(Observable.just(response));
    mLoginPresenter.login("user@email.com","password");
    verify(view).loginSuccess();
}

@Test
public void testLoginWithIncorrectUserNameAndPassword() throws Exception {
    // create or mock response object
    when(service.login(anyString(), anyString(), anyString).thenReturn(Observable.<Response>error(new IOException()));
    mLoginPresenter.login("user@email.com","password");
    verify(view).showError(anyString);
}
25
задан Jeroen 27 May 2018 в 16:16
поделиться

2 ответа

Поместите текст в Центр:

Container(
      height: 45,
      color: Colors.black,
      child: Center(
        child: Text(
            'test',
            style: TextStyle(color: Colors.white),
        ),
      ),
    );
0
ответ дан 27 November 2019 в 04:02
поделиться
                       child: Align(
                          alignment: Alignment.center,
                          child: Text(
                            'Text here',
                            textAlign: TextAlign.center,                          
                          ),
                        ),

Это привело к лучшему результату для меня.

0
ответ дан 27 November 2019 в 04:02
поделиться
Другие вопросы по тегам:

Похожие вопросы: