idle
This commit is contained in:
@@ -185,124 +185,122 @@ class _FileExplorerState extends State<FileExplorer> {
|
||||
curve: Curves.easeInOut,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
_isSearching ? Icons.close : Icons.search,
|
||||
color: AppTheme.accentColor,
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onPressed: () {
|
||||
if (_isSearching) {
|
||||
setState(() {
|
||||
_showField = false;
|
||||
_isSearching = false;
|
||||
_searchController.clear();
|
||||
_searchQuery = '';
|
||||
context.read<FileBrowserBloc>().add(ApplyFilter(''));
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isSearching = true;
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
setState(() {
|
||||
_showField = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 800),
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
_isSearching ? Icons.close : Icons.search,
|
||||
color: AppTheme.accentColor,
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onPressed: () {
|
||||
if (_isSearching) {
|
||||
setState(() {
|
||||
_showField = false;
|
||||
_isSearching = false;
|
||||
_searchController.clear();
|
||||
_searchQuery = '';
|
||||
context.read<FileBrowserBloc>().add(ApplyFilter(''));
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isSearching = true;
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
setState(() {
|
||||
_showField = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
top: 0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 2),
|
||||
child: BlocBuilder<FileBrowserBloc, FileBrowserState>(
|
||||
builder: (context, state) {
|
||||
String currentSort = 'name';
|
||||
bool isAscending = true;
|
||||
if (state is DirectoryLoaded) {
|
||||
currentSort = state.sortBy;
|
||||
isAscending = state.isAscending;
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
PopupMenuButton<String>(
|
||||
color: AppTheme.accentColor.withAlpha(200),
|
||||
|
||||
BlocBuilder<FileBrowserBloc, FileBrowserState>(
|
||||
builder: (context, state) {
|
||||
String currentSort = 'name';
|
||||
bool isAscending = true;
|
||||
if (state is DirectoryLoaded) {
|
||||
currentSort = state.sortBy;
|
||||
isAscending = state.isAscending;
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
PopupMenuButton<String>(
|
||||
color: AppTheme.accentColor.withAlpha(200),
|
||||
position: PopupMenuPosition.under,
|
||||
offset: const Offset(48, 8),
|
||||
itemBuilder: (BuildContext context) => [
|
||||
const PopupMenuItem(
|
||||
value: 'name',
|
||||
|
||||
position: PopupMenuPosition.under,
|
||||
offset: const Offset(48, 8),
|
||||
itemBuilder: (BuildContext context) => [
|
||||
const PopupMenuItem(
|
||||
value: 'name',
|
||||
|
||||
child: Text('Name'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'date',
|
||||
child: Text('Date'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'size',
|
||||
child: Text('Size'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'type',
|
||||
child: Text('Type'),
|
||||
),
|
||||
],
|
||||
onSelected: (value) {
|
||||
context.read<FileBrowserBloc>().add(
|
||||
ApplySort(value, isAscending: isAscending),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: AppTheme.primaryText,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
currentSort == 'name'
|
||||
? 'Name'
|
||||
: currentSort == 'date'
|
||||
? 'Date'
|
||||
: currentSort == 'size'
|
||||
? 'Size'
|
||||
: 'Type',
|
||||
style: const TextStyle(
|
||||
color: AppTheme.primaryText,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Text('Name'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
isAscending
|
||||
? Icons.arrow_upward
|
||||
: Icons.arrow_downward,
|
||||
color: AppTheme.accentColor,
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onPressed: () {
|
||||
context.read<FileBrowserBloc>().add(
|
||||
ApplySort(
|
||||
currentSort,
|
||||
isAscending: !isAscending,
|
||||
),
|
||||
);
|
||||
},
|
||||
const PopupMenuItem(
|
||||
value: 'date',
|
||||
child: Text('Date'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'size',
|
||||
child: Text('Size'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'type',
|
||||
child: Text('Type'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
onSelected: (value) {
|
||||
context.read<FileBrowserBloc>().add(
|
||||
ApplySort(value, isAscending: isAscending),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: AppTheme.primaryText,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
currentSort == 'name'
|
||||
? 'Name'
|
||||
: currentSort == 'date'
|
||||
? 'Date'
|
||||
: currentSort == 'size'
|
||||
? 'Size'
|
||||
: 'Type',
|
||||
style: const TextStyle(
|
||||
color: AppTheme.primaryText,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
isAscending
|
||||
? Icons.arrow_upward
|
||||
: Icons.arrow_downward,
|
||||
color: AppTheme.accentColor,
|
||||
),
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onPressed: () {
|
||||
context.read<FileBrowserBloc>().add(
|
||||
ApplySort(currentSort, isAscending: !isAscending),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user