v1.0.2: Fix syntax error and complete Android TV remote navigation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class SimpleCountriesSidebar extends StatelessWidget {
|
||||
final List<String> countries;
|
||||
@@ -101,27 +102,48 @@ class SimpleCountriesSidebar extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildCountryItem(String name, bool isSelected, VoidCallback onTap) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.red : Colors.transparent,
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: isSelected ? Colors.white : Colors.transparent,
|
||||
width: 4,
|
||||
return FocusableActionDetector(
|
||||
actions: <Type, Action<Intent>>{
|
||||
ActivateIntent: CallbackAction<ActivateIntent>(
|
||||
onInvoke: (intent) {
|
||||
onTap();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
ButtonActivateIntent: CallbackAction<ButtonActivateIntent>(
|
||||
onInvoke: (intent) {
|
||||
onTap();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
},
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final hasFocus = Focus.of(context).hasFocus;
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.red : (hasFocus ? Colors.red.withValues(alpha: 0.5) : Colors.transparent),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: isSelected ? Colors.white : (hasFocus ? Colors.white : Colors.transparent),
|
||||
width: 4,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -186,39 +208,60 @@ class SimpleCountriesSidebar extends StatelessWidget {
|
||||
|
||||
Widget _buildFootballItem() {
|
||||
final isSelected = selectedCountry == _footballCategoryName;
|
||||
return InkWell(
|
||||
onTap: onFootballSelected,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.green[700] : Colors.green[900]?.withOpacity(0.3),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: isSelected ? Colors.white : Colors.green[400]!,
|
||||
width: 4,
|
||||
),
|
||||
),
|
||||
return FocusableActionDetector(
|
||||
actions: <Type, Action<Intent>>{
|
||||
ActivateIntent: CallbackAction<ActivateIntent>(
|
||||
onInvoke: (intent) {
|
||||
onFootballSelected?.call();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.sports_soccer,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_footballCategoryName,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
ButtonActivateIntent: CallbackAction<ButtonActivateIntent>(
|
||||
onInvoke: (intent) {
|
||||
onFootballSelected?.call();
|
||||
return null;
|
||||
},
|
||||
),
|
||||
},
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final hasFocus = Focus.of(context).hasFocus;
|
||||
return GestureDetector(
|
||||
onTap: onFootballSelected,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.green[700] : (hasFocus ? Colors.green[700]?.withOpacity(0.8) : Colors.green[900]?.withOpacity(0.3)),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: isSelected ? Colors.white : (hasFocus ? Colors.white : Colors.green[400]!),
|
||||
width: 4,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.sports_soccer,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
_footballCategoryName,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user