fix: some fixes

This commit is contained in:
2024-06-09 12:47:59 +03:00
parent 04ee6d1699
commit 9335e8e694
7 changed files with 80 additions and 85 deletions

View File

@@ -22,6 +22,11 @@ class GymLinkAppBar extends StatelessWidget implements PreferredSizeWidget {
width: 24,
height: 24,
semanticsLabel: 'GymLink Logo',
colorFilter: ColorFilter.mode(
Theme.of(context).brightness == Brightness.dark
? Colors.white
: Colors.black,
BlendMode.srcIn),
),
),
Align(

View File

@@ -129,7 +129,7 @@ class _ExamplePageState extends State<ExamplePage> {
Future<void> _setToken() async {
final token = await getToken('eeb42dcb-8e5b-4f21-825a-3fc7ada43445', '123');
if (token != '') {
context.read<GymLinkProvider>().onTokenReceived(token);
context.read<GymLinkProvider>().checkToken(token);
} else {
context.read<GymLinkProvider>().onError();
}
@@ -205,7 +205,7 @@ class _ExampleClub2PageState extends State<ExampleClub2Page> {
final token = await getToken('a8622a61-3142-487e-8db8-b6aebd4f04aa', '123');
context.read<GymLinkProvider>().changeTheme(0xFFAABCAB);
if (token != '') {
context.read<GymLinkProvider>().onTokenReceived(token);
context.read<GymLinkProvider>().checkToken(token);
} else {
context.read<GymLinkProvider>().onError();
}

View File

@@ -73,6 +73,7 @@ class _MainPageState extends State<MainPage> {
bool isSearching = false;
List<GymCategory> categories = [];
GymCategory? selectedCategory;
final ScrollController _scrollController = ScrollController();
@override
void initState() {
@@ -122,7 +123,7 @@ class _MainPageState extends State<MainPage> {
});
}
void _onSearch() async {
void _onSearch() {
final categoryId = selectedCategory == null ? '' : selectedCategory!.id;
_searchItems(searchText: searchText, categoryId: categoryId);
}
@@ -250,7 +251,9 @@ class _MainPageState extends State<MainPage> {
onEndOfPage: _onLoad,
isLoading: isLoading,
child: Scrollbar(
controller: _scrollController,
child: ListView(
controller: _scrollController,
children: [
filteredData.isEmpty &&
(searchText != '' || selectedCategory != null) &&

View File

@@ -14,17 +14,10 @@ class GymLinkProvider with ChangeNotifier {
void Function() get onError => _onError;
void onTokenReceived(String token) {
void checkToken(String token) {
_token = token;
_isLoading = false;
notifyListeners();
// if (token == 'token123') {
// _isLoading = false;
// notifyListeners();
// } else {
// _isLoading = true;
// notifyListeners();
// }
}
void changeTheme(int color, {bool blackTheme = false}) {

View File

@@ -48,13 +48,13 @@ class MyAppStateWeb extends State<MyApp> {
}
@js.JSExport()
void onTokenReceived(String token) {
context.read<GymLinkProvider>().onTokenReceived(token);
void checkToken(String token) {
context.read<GymLinkProvider>().checkToken(token);
}
@js.JSExport()
void changeColor(int color) {
context.read<GymLinkProvider>().changeTheme(color);
void changeColor(int color, bool blackTheme) {
context.read<GymLinkProvider>().changeTheme(color, blackTheme: blackTheme);
}
@js.JSExport()