-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bottom_bar bloc and allow app share
- Loading branch information
1 parent
57d54f7
commit d2368a9
Showing
9 changed files
with
192 additions
and
112 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:bloc/bloc.dart'; | ||
|
||
import '../bloc.dart'; | ||
|
||
|
||
class BottomBarBloc extends Bloc<BottomBarEvent, BottomBarState> { | ||
@override | ||
BottomBarState get initialState => InitialBottomBarState(); | ||
|
||
@override | ||
Stream<BottomBarState> mapEventToState( | ||
BottomBarEvent event, | ||
) async* { | ||
if (event is BottomBarSelected) { | ||
yield BottomBarSelectedSuccess(selectedIndex: event.selectedIndex); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:equatable/equatable.dart'; | ||
|
||
abstract class BottomBarEvent extends Equatable { | ||
const BottomBarEvent(); | ||
} | ||
|
||
class BottomBarSelected extends BottomBarEvent { | ||
final int selectedIndex; | ||
|
||
BottomBarSelected(this.selectedIndex); | ||
|
||
@override | ||
List<Object> get props => [selectedIndex]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:equatable/equatable.dart'; | ||
|
||
abstract class BottomBarState extends Equatable { | ||
final int selectedIndex; | ||
const BottomBarState({ this.selectedIndex = 0 }); | ||
} | ||
|
||
class InitialBottomBarState extends BottomBarState { | ||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
class BottomBarSelectedSuccess extends BottomBarState { | ||
BottomBarSelectedSuccess({ selectedIndex = 0 }) | ||
: super(selectedIndex: selectedIndex); | ||
|
||
@override | ||
List<Object> get props => [selectedIndex]; | ||
} |
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
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
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
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