Update player panel UI.
This commit is contained in:
parent
7c13058463
commit
b9b88feb42
|
@ -229,24 +229,27 @@ class PlayerWidget extends StatelessWidget {
|
||||||
if (!data.item1) {
|
if (!data.item1) {
|
||||||
return Center();
|
return Center();
|
||||||
} else {
|
} else {
|
||||||
var minHeight = kMinPlayerHeight[data.item2.index];
|
final minHeight = kMinPlayerHeight[data.item2.index];
|
||||||
var maxHeight = math.min(kMaxPlayerHeight[data.item2.index] as double,
|
final maxHeight = math.min(
|
||||||
|
kMaxPlayerHeight[data.item2.index] as double,
|
||||||
context.height - 20);
|
context.height - 20);
|
||||||
return AudioPanel(
|
return AudioPanel(
|
||||||
minHeight: minHeight,
|
minHeight: minHeight,
|
||||||
|
maxHeight: maxHeight,
|
||||||
|
expandHeight: context.height - 40,
|
||||||
|
key: playerKey,
|
||||||
|
miniPanel: _miniPanel(context),
|
||||||
|
expandedPanel: ControlPanel(
|
||||||
maxHeight: maxHeight,
|
maxHeight: maxHeight,
|
||||||
key: playerKey,
|
isPlayingPage: isPlayingPage,
|
||||||
miniPanel: _miniPanel(context),
|
onExpand: () {
|
||||||
expandedPanel: ControlPanel(
|
playerKey.currentState.scrollToTop();
|
||||||
maxHeight: maxHeight,
|
},
|
||||||
isPlayingPage: isPlayingPage,
|
onClose: () {
|
||||||
onExpand: () {
|
playerKey.currentState.backToMini();
|
||||||
playerKey.currentState.scrollToTop();
|
},
|
||||||
},
|
),
|
||||||
onClose: () {
|
);
|
||||||
playerKey.currentState.backToMini();
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -408,7 +411,7 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
height: 300,
|
height: context.height - 340,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: context.accentColor.withAlpha(70),
|
color: context.accentColor.withAlpha(70),
|
||||||
|
@ -421,132 +424,7 @@ class _PlaylistWidgetState extends State<PlaylistWidget> {
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child:
|
child: ListView.builder(
|
||||||
// data.item1.name == 'Queue'
|
|
||||||
// ? AnimatedList(
|
|
||||||
// key: miniPlaylistKey,
|
|
||||||
// shrinkWrap: true,
|
|
||||||
// scrollDirection: Axis.vertical,
|
|
||||||
// initialItemCount: episodes.length,
|
|
||||||
// itemBuilder: (context, index, animation) =>
|
|
||||||
// ScaleTransition(
|
|
||||||
// alignment: Alignment.center,
|
|
||||||
// scale: animation,
|
|
||||||
// child: Column(
|
|
||||||
// children: <Widget>[
|
|
||||||
// Row(
|
|
||||||
// children: <Widget>[
|
|
||||||
// Expanded(
|
|
||||||
// child: Material(
|
|
||||||
// color: Colors.transparent,
|
|
||||||
// child: InkWell(
|
|
||||||
// onTap: () {
|
|
||||||
// audio.episodeLoad(episodes[index]);
|
|
||||||
// miniPlaylistKey.currentState
|
|
||||||
// .removeItem(
|
|
||||||
// index,
|
|
||||||
// (context, animation) =>
|
|
||||||
// Center());
|
|
||||||
// },
|
|
||||||
// child: Container(
|
|
||||||
// height: 60,
|
|
||||||
// padding: EdgeInsets.symmetric(
|
|
||||||
// horizontal: 20),
|
|
||||||
// alignment: Alignment.centerLeft,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment:
|
|
||||||
// MainAxisAlignment.center,
|
|
||||||
// crossAxisAlignment:
|
|
||||||
// CrossAxisAlignment.center,
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: <Widget>[
|
|
||||||
// Container(
|
|
||||||
// padding: EdgeInsets.all(10.0),
|
|
||||||
// child: ClipRRect(
|
|
||||||
// borderRadius:
|
|
||||||
// BorderRadius.all(
|
|
||||||
// Radius.circular(
|
|
||||||
// 15.0)),
|
|
||||||
// child: Container(
|
|
||||||
// height: 30.0,
|
|
||||||
// width: 30.0,
|
|
||||||
// child: Image.file(File(
|
|
||||||
// "${episodes[index].imagePath}"))),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: Align(
|
|
||||||
// alignment:
|
|
||||||
// Alignment.centerLeft,
|
|
||||||
// child: Text(
|
|
||||||
// episodes[index].title,
|
|
||||||
// maxLines: 1,
|
|
||||||
// overflow:
|
|
||||||
// TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// horizontal: 20.0),
|
|
||||||
// child: Material(
|
|
||||||
// borderRadius:
|
|
||||||
// BorderRadius.circular(100),
|
|
||||||
// clipBehavior: Clip.hardEdge,
|
|
||||||
// color: context.primaryColor,
|
|
||||||
// child: InkWell(
|
|
||||||
// borderRadius: BorderRadius.all(
|
|
||||||
// Radius.circular(15.0)),
|
|
||||||
// onTap: () async {
|
|
||||||
// var episdoe =
|
|
||||||
// episodes.removeAt(index);
|
|
||||||
// episodes.insert(0, episdoe);
|
|
||||||
// miniPlaylistKey.currentState
|
|
||||||
// .removeItem(
|
|
||||||
// index,
|
|
||||||
// (context, animation) {
|
|
||||||
// return Center();
|
|
||||||
// },
|
|
||||||
// duration: Duration.zero,
|
|
||||||
// );
|
|
||||||
// miniPlaylistKey.currentState
|
|
||||||
// .insertItem(
|
|
||||||
// 0,
|
|
||||||
// duration: Duration(
|
|
||||||
// milliseconds: 100));
|
|
||||||
// await Future.delayed(
|
|
||||||
// Duration(milliseconds: 100));
|
|
||||||
// await audio.moveToTop(
|
|
||||||
// data.item1.episodes[index + 1]);
|
|
||||||
// },
|
|
||||||
// child: SizedBox(
|
|
||||||
// height: 30.0,
|
|
||||||
// width: 30.0,
|
|
||||||
// child: Transform.rotate(
|
|
||||||
// angle: math.pi,
|
|
||||||
// child: Icon(
|
|
||||||
// LineIcons.download_solid,
|
|
||||||
// size: 20.0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// Divider(height: 1),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
ListView.builder(
|
|
||||||
itemCount: episodes.length,
|
itemCount: episodes.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final isPlaying = episodes[index] != null &&
|
final isPlaying = episodes[index] != null &&
|
||||||
|
@ -1375,7 +1253,7 @@ class _ControlPanelState extends State<ControlPanel>
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 300,
|
height: context.height - 360,
|
||||||
child: ScrollConfiguration(
|
child: ScrollConfiguration(
|
||||||
behavior: NoGrowBehavior(),
|
behavior: NoGrowBehavior(),
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
|
|
|
@ -12,6 +12,7 @@ class AudioPanel extends StatefulWidget {
|
||||||
final Widget optionPanel;
|
final Widget optionPanel;
|
||||||
final double minHeight;
|
final double minHeight;
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
|
final double expandHeight;
|
||||||
|
|
||||||
AudioPanel(
|
AudioPanel(
|
||||||
{@required this.miniPanel,
|
{@required this.miniPanel,
|
||||||
|
@ -19,6 +20,7 @@ class AudioPanel extends StatefulWidget {
|
||||||
this.optionPanel,
|
this.optionPanel,
|
||||||
this.minHeight = 70,
|
this.minHeight = 70,
|
||||||
this.maxHeight = 300,
|
this.maxHeight = 300,
|
||||||
|
this.expandHeight,
|
||||||
Key key})
|
Key key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
|
@ -53,7 +55,8 @@ class AudioPanelState extends State<AudioPanel> with TickerProviderStateMixin {
|
||||||
_controller.forward();
|
_controller.forward();
|
||||||
_slideDirection = SlideDirection.up;
|
_slideDirection = SlideDirection.up;
|
||||||
super.initState();
|
super.initState();
|
||||||
_expandHeight = widget.maxHeight + 316;
|
_expandHeight = widget.expandHeight;
|
||||||
|
// _expandHeight = widget.maxHeight + 316;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -67,7 +70,8 @@ class AudioPanelState extends State<AudioPanel> with TickerProviderStateMixin {
|
||||||
void didUpdateWidget(AudioPanel oldWidget) {
|
void didUpdateWidget(AudioPanel oldWidget) {
|
||||||
if (oldWidget.maxHeight != widget.maxHeight) {
|
if (oldWidget.maxHeight != widget.maxHeight) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_expandHeight = widget.maxHeight + 316;
|
//_expandHeight = widget.maxHeight + 316;
|
||||||
|
_expandHeight = widget.expandHeight;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
|
|
Loading…
Reference in New Issue