feat: UI pages
This commit is contained in:
1 parent
fbcd33ea2b
commit
197c3e9b88
41 files changed
+1270
-274
No files matched your search
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:skywood/main/lib_file.dart';
|
||||
import 'package:skywood/utils/tools/widgets/sky_common_widget.dart';
|
||||
|
||||
class LikeHeader extends StatefulWidget {
|
||||
|
||||
const LikeHeader({super.key,
|
||||
required this.onSelectedIndex,
|
||||
});
|
||||
|
||||
final Function(int) onSelectedIndex;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _LikeHeaderState();
|
||||
}
|
||||
}
|
||||
|
||||
class _LikeHeaderState extends State<LikeHeader> {
|
||||
|
||||
int _selectedIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 55,
|
||||
child: Row(
|
||||
children: [
|
||||
_buildCollectionBg(0, 'My collection'),
|
||||
_buildCollectionBg(1, 'Play Log'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// shadows: [Shadow(offset: Offset(1, 1), blurRadius: 0, color: Color(0xFF040408).withOpacity(1.00))],
|
||||
Widget _buildCollectionBg(int index, String title) {
|
||||
String img = index == _selectedIndex ? ConstImg.likeSelectedBg : ConstImg.likeUnselectBg;
|
||||
return SizedBox(
|
||||
width: 155.w, height: 55,
|
||||
child: Stack(
|
||||
children: [
|
||||
HelpImg.asset(img, width: 155.w, height: 55, fit: BoxFit.fill),
|
||||
Positioned(
|
||||
right: 22, bottom: 12, left: 28,
|
||||
child: SkyText(text: title,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: index == _selectedIndex ? Colors.white : CommonColor.withValue('B1B1B1'),
|
||||
shadow: index == _selectedIndex
|
||||
? Shadow(offset: Offset(1, 1), blurRadius: 0, color: Color(0xFF040408).withOpacity(1.00))
|
||||
: null,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
).addInkWell(onTap: () {
|
||||
if (_selectedIndex == index) return;
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
});
|
||||
widget.onSelectedIndex(index);
|
||||
},);
|
||||
}
|
||||
|
||||
_buildLogBg() {
|
||||
return Container(
|
||||
width: 160.w, height: 55,
|
||||
child: HelpImg.asset(ConstImg.playlogBg, fit: BoxFit.fill),
|
||||
).addInkWell(onTap: () {
|
||||
if (_selectedIndex == 1) return;
|
||||
setState(() {
|
||||
_selectedIndex = 1;
|
||||
});
|
||||
},);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user