Improved mobile layout
This commit is contained in:
@@ -31,7 +31,7 @@ class AccountCounter extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.all(20),
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: Theme.of(context).colorScheme.primaryContainer,
|
||||
|
||||
@@ -11,7 +11,7 @@ class CategoriesTotalsChart extends StatelessWidget {
|
||||
|
||||
const CategoriesTotalsChart({super.key, required this.categoriesTotals, required this.categoriesTotalsPercents});
|
||||
|
||||
List<PieChartSectionData> _convertDataForChart(Map<String, Color> categoriesColors) {
|
||||
List<PieChartSectionData> _convertDataForChart(Map<String, Color> categoriesColors, bool smallVerticalScreen) {
|
||||
return categoriesTotalsPercents
|
||||
.map((item) =>
|
||||
PieChartSectionData(
|
||||
@@ -21,9 +21,10 @@ class CategoriesTotalsChart extends StatelessWidget {
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w300
|
||||
),
|
||||
showTitle: !smallVerticalScreen,
|
||||
titlePositionPercentageOffset: 0.5,
|
||||
borderSide: const BorderSide(width: 0),
|
||||
radius: 40,
|
||||
radius: smallVerticalScreen ? 30 : 40,
|
||||
color: categoriesColors[item.label]
|
||||
))
|
||||
.toList();
|
||||
@@ -60,10 +61,11 @@ class CategoriesTotalsChart extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool smallVerticalScreen = MediaQuery.sizeOf(context).width < 800;
|
||||
return BlocBuilder<CategoryBloc, CategoryState>(
|
||||
builder: (context, state) => Container(
|
||||
height: 320,
|
||||
width: 500,
|
||||
width: smallVerticalScreen ? null : 500,
|
||||
padding: const EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
@@ -84,11 +86,11 @@ class CategoriesTotalsChart extends StatelessWidget {
|
||||
Expanded(
|
||||
child: PieChart(
|
||||
PieChartData(
|
||||
sections: _convertDataForChart(state.categoriesColors),
|
||||
sections: _convertDataForChart(state.categoriesColors, smallVerticalScreen),
|
||||
borderData: FlBorderData(
|
||||
show: false
|
||||
),
|
||||
centerSpaceRadius: 50,
|
||||
centerSpaceRadius: smallVerticalScreen ? 30 :50,
|
||||
sectionsSpace: 4
|
||||
)
|
||||
),
|
||||
|
||||
@@ -10,7 +10,7 @@ class GlobalCounter extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
margin: const EdgeInsets.all(20),
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
color: Theme.of(context).colorScheme.primaryContainer,
|
||||
|
||||
Reference in New Issue
Block a user