Fix image size issue (#24)
parent
c67c966457
commit
066f4d29fc
9 changed files with 237 additions and 52 deletions
@ -0,0 +1,4 @@ |
|||||||
|
// ignore: camel_case_types |
||||||
|
class platformViewRegistry { |
||||||
|
static registerViewFactory(String viewId, dynamic cb) {} |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
import 'dart:ui' as ui; |
||||||
|
|
||||||
|
// ignore: camel_case_types |
||||||
|
class platformViewRegistry { |
||||||
|
static registerViewFactory(String viewId, dynamic cb) { |
||||||
|
// ignore:undefined_prefixed_name |
||||||
|
ui.platformViewRegistry.registerViewFactory(viewId, cb); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
import 'package:flutter/material.dart'; |
||||||
|
|
||||||
|
class ResponsiveWidget extends StatelessWidget { |
||||||
|
final Widget largeScreen; |
||||||
|
final Widget mediumScreen; |
||||||
|
final Widget smallScreen; |
||||||
|
|
||||||
|
const ResponsiveWidget( |
||||||
|
{Key key, |
||||||
|
@required this.largeScreen, |
||||||
|
this.mediumScreen, |
||||||
|
this.smallScreen}) |
||||||
|
: super(key: key); |
||||||
|
|
||||||
|
static bool isSmallScreen(BuildContext context) { |
||||||
|
return MediaQuery.of(context).size.width < 800; |
||||||
|
} |
||||||
|
|
||||||
|
static bool isLargeScreen(BuildContext context) { |
||||||
|
return MediaQuery.of(context).size.width > 1200; |
||||||
|
} |
||||||
|
|
||||||
|
static bool isMediumScreen(BuildContext context) { |
||||||
|
return MediaQuery.of(context).size.width >= 800 && |
||||||
|
MediaQuery.of(context).size.width <= 1200; |
||||||
|
} |
||||||
|
|
||||||
|
@override |
||||||
|
Widget build(BuildContext context) { |
||||||
|
return LayoutBuilder( |
||||||
|
builder: (context, constraints) { |
||||||
|
if (constraints.maxWidth > 1200) { |
||||||
|
return largeScreen; |
||||||
|
} else if (constraints.maxWidth <= 1200 && |
||||||
|
constraints.maxWidth >= 800) { |
||||||
|
return mediumScreen ?? largeScreen; |
||||||
|
} else { |
||||||
|
return smallScreen ?? largeScreen; |
||||||
|
} |
||||||
|
}, |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue