feat: 首页顶栏&底栏固定 issues #243
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
@ -15,6 +17,10 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
RxBool userLogin = false.obs;
|
||||
RxString userFace = ''.obs;
|
||||
var userInfo;
|
||||
Box setting = GStrorage.setting;
|
||||
late final StreamController<bool> searchBarStream =
|
||||
StreamController<bool>.broadcast();
|
||||
late bool hideSearchBar;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@ -33,6 +39,8 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
||||
length: tabs.length,
|
||||
vsync: this,
|
||||
);
|
||||
hideSearchBar =
|
||||
setting.get(SettingBoxKey.hideSearchBar, defaultValue: true);
|
||||
}
|
||||
|
||||
void onRefresh() {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||
@ -18,11 +20,17 @@ class _HomePageState extends State<HomePage>
|
||||
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
|
||||
final HomeController _homeController = Get.put(HomeController());
|
||||
List videoList = [];
|
||||
Stream<bool> stream = Get.find<MainController>().bottomBarStream.stream;
|
||||
late Stream<bool> stream;
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
stream = _homeController.searchBarStream.stream;
|
||||
}
|
||||
|
||||
showUserBottonSheet() {
|
||||
feedBack();
|
||||
showModalBottomSheet(
|
||||
@ -46,7 +54,9 @@ class _HomePageState extends State<HomePage>
|
||||
body: Column(
|
||||
children: [
|
||||
CustomAppBar(
|
||||
stream: stream,
|
||||
stream: _homeController.hideSearchBar
|
||||
? stream
|
||||
: StreamController<bool>.broadcast().stream,
|
||||
ctr: _homeController,
|
||||
callback: showUserBottonSheet,
|
||||
),
|
||||
@ -118,7 +128,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
duration: const Duration(milliseconds: 500),
|
||||
height: snapshot.data
|
||||
? MediaQuery.of(context).padding.top + 52
|
||||
: MediaQuery.of(context).padding.top,
|
||||
: MediaQuery.of(context).padding.top - 10,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
|
Reference in New Issue
Block a user