This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:equatable/equatable.dart'; | |
abstract class AuthenticationState extends Equatable {} | |
class AuthenticationUninitialized extends AuthenticationState { | |
@override | |
String toString() => 'AuthenticationUninitialized'; | |
} | |
class AuthenticationAuthenticated extends AuthenticationState { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:equatable/equatable.dart'; | |
import 'package:parse_server_sdk/parse_server_sdk.dart'; | |
abstract class AuthenticationEvent extends Equatable { | |
AuthenticationEvent([List props = const []]) : super(props); | |
} | |
class AppStarted extends AuthenticationEvent { | |
@override | |
String toString() => 'AppStarted'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_bloc_back4app/data/models/message.dart'; | |
import 'package:parse_server_sdk/parse_server_sdk.dart'; | |
class MessageRepository { | |
MessageRepository(); | |
Future<List> loadAllMessages() async { | |
var apiResponse = await Message().getAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:meta/meta.dart'; | |
import 'package:parse_server_sdk/parse_server_sdk.dart'; | |
class UserRepository { | |
UserRepository(); | |
/// Auth [email], [password] | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget _buildListOfMessages(HomeState state) { | |
if (state is HomeLoaded) { | |
lst = state.lstMessages; | |
} | |
return Stack( | |
children: <Widget>[ | |
ListView.separated( | |
itemCount: lst.length, | |
itemBuilder: (BuildContext context, int index) { | |
return Center( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return MultiBlocListener( | |
listeners: [ | |
BlocListener<SignupCubit, SignupState>( | |
listener: (context, state) { | |
if (state is SignupSuccess) { | |
context.read<AuthCubit>().appStarted(); | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return BlocListener<LoginCubit, LoginState>( | |
listener: (context, state) { | |
if (state is LoginFailure) { | |
_scaffoldstate.currentState.showSnackBar(SnackBar(content: Text(state.error))); | |
} else if (state is LoginSuccess) { | |
context.read<AuthCubit>().appStarted(); | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const String PARSE_APP_ID = '{YOUR APP ID}'; | |
const String PARSE_APP_URL = 'https://parseapi.back4app.com'; | |
const String MASTER_KEY = '{YOUR MASTER KEY}'; | |
const String LIVE_QUERY_URL = 'wss://trongdth.back4app.io'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
void initState() { | |
... | |
_focusNode.addListener(() { | |
if (!_focusNode.hasFocus) { | |
setState(() { | |
if (txtController.text.isEmpty) { | |
isShowHintText = true; | |
} else { | |
isShowHintText = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
children: <Widget>[ | |
Align( | |
alignment: Alignment.bottomLeft, | |
child: Text( | |
(isShowHintText) ? '' : overlapText, | |
textAlign: TextAlign.start, | |
style: (txtController.text.isEmpty) ? widget.lblNormalStyle : widget.lblHighlightStyle, |