Вы можете сделать это следующим образом:
@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);
}
Поместите текст в Центр:
Container(
height: 45,
color: Colors.black,
child: Center(
child: Text(
'test',
style: TextStyle(color: Colors.white),
),
),
);
child: Align(
alignment: Alignment.center,
child: Text(
'Text here',
textAlign: TextAlign.center,
),
),
Это привело к лучшему результату для меня.