Ellis Herbert

Ellis Herbert

1596471000

Flutter app demo, using Material theme

First Flutter Demo by alfred, there are multiple demo in it. This is my first Flutter Demo code, which contains multiple demos.

Login/SignUp

have 3 screens. First screen is a welcome screen for user to choose login or sign up.At welcome screen if user hit the login button the will shifts to the login screen,otherwise it will shifts user to the sign up screen. There are three interfaces . The first interface is a welcome interface, where users can choose to log in or register. If the user clicks the login button, it will jump to the login interface, otherwise it will jump to the registration interface.

EShop

have 2 screens. First you will see a goods list, when user hit the goods item, it will shifts to detail screen by hero animation. There are two interfaces. The first entry is the product list page. When the user clicks on the product, it jumps to the product details page. Demo uses Hero animation.

Movie App

have 2 screens. First you will see a movie list that only contains 3 movies.User can switch the card to check other movies.when user hit the card it will shifts to the detail screen that show more information about the movie. There are two interface. The first entry is the product list page. When the user clicks on the product, it jumps to the product details page. Demo uses Hero animation.

install Flutter on Mac

  1. Open Terminal
  2. Get SDK from https://github.com/flutter/flutter.git
  3. run the following command to create and open .bash_profile
touch ~/.bash_profile
code ~/.bash_profile
  1. insert the following code to .bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH= SDKPATH/bin:$PATH

the SDKPATH is your sdk path

  1. run the following code to set PATH variable to the current terminal.
source ~/.bash_profile
  1. run command code ~/.zshrc to open z shell config file. Then append command source ~/.bash_profile to .zshrc file. so the flutter will add to your path permanently.
  2. run command flutter doctor to check if there are any dependencies is not installed in your compute.According to the output describe, you will know how to perform these tasks.

Flutter environment deployment (MacBook)/

  1. Pull the SDK from https://github.com/flutter/flutter.git .

  2. Open terminal

  3. Run the following code to create and open the .bash_profile file.

touch ~/.bash_profile
code ~/.bash_profile
  1. Enter the following in Visual Studio Code:
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH= SDKPATH/bin:$PATH
  1. Where SDKPATH is the installation directory of SDK
  2. Run the following code to update the terminal environment variables
source ~/.bash_profile
  1. Run to code ~/.zshrcopen the terminal configuration file and enter source ~/.bash_profile. This will automatically help set environment variables every time you open the terminal.
  2. Run flutter doctorcheck environment is missing, and perform dependent installation according to the prompt statement.

Knowledge of components used

StatelessWidget

Stateless Widget. Once the parameters are passed, they cannot be changed. When there is no need to rely on the parent container, this Widget is preferred.

StatefulWidget

For a stateful Widget, you need to define a class that inherits from StateFulWidget, and the createState method must be rewritten in the class, which returns an instance of a class inherited from State. The interface can be dynamically rendered.

Scaffold

The official document realizes the most basic material design visual effects. Provides APIs for drawer menu, snack and sheet action. If you want to display the snackbar or sheet action, you need to obtain the ScaffoldState through Scaffold.of through the current context, and then call it through ScaffoldState.showSnackBar or scaffoldState.showBottomSheet.

Common attributes:

  • appBar(PreferredSizeWidget): AppBar settings
  • backgroundColor(Color): background color
  • body(Widget): body sub-content
  • bottomNavigationBar(Widget): bottom navigation bar
  • bottomSheet(Widget):Sheet Action
  • drawer(Widget): drawer
  • drawerDragStartBehavior(DragStartBehavior): drawer drag start behavior
  • drawerEdgeDragWidth(double): the width of the drawer from the edge
  • drawerEnableOpenDragGesture(bool): whether the drawer can be opened by edge gesture
  • floatingActionButton(Widget): floating button
  • floatingActionButtonAnimator(FloatingActionButtonAnimator): floating button animation
  • floatingActionButtonLocation(FloatingActionButtonLocation): floating button location

Container

The most common and commonly used containers can be combined with common drawing, positioning and customizing components.

The container first renders the padding, and then applies additional constraints (constraints) to the content that has been rendered with the padding (if the height and width settings are not empty, the height and width are merged into the constraints). Finally, the container will be wrapped in the blank content of the margin.

In the drawing process, the container first applies the incoming transform, then draws the background (decoration) based on padding, then draws its sub-content, and finally draws the foreground (foregroundDecoration) based on padding.

Containers without child content will be drawn as large as possible, unless configured or the size of the parent content is restricted (constraints). When constraints are configured, the container will be drawn as small as possible. If the container contains sub-content, it will be adjusted according to the size of the sub-content. Unless the width, height and constrain are configured in the constructor.

Common attributes:

  • alignment(AlignmentGeometry): the alignment method of sub-content
  • child(Widget): child content
  • color(Color): background color
  • constraints(BoxConstraints): restriction rules for sub-content
  • decoration(Decoration): background decoration of the container
  • foregroundDecoration(Decoration): foreground decoration of the container
  • margin(EdgeInsetsGeometry): outer margin
  • padding(EdgeInsetsGeometry): inner margin

Layout behavior: The container contains a number of other incompatible widgets and their incompatible layouts, so the layout behavior of the container will be a bit complicated. In short, the container tries to be ordered:

  • Rendering
  • Adjust your size based on sub-content
  • Rendering width and height
  • Restrict sub-content
  • Expand yourself to adapt to the parent container
  • As small as possible

More specific content such as:

  • If the component has no child content, no width and height, no restriction, and no restriction on its parent container, the container will be as small as possible.
  • If the component has no child content and no alignment method, but the width and height or constraints are set, the container will combine the constraints and the constraints of the parent container to be as small as possible.
  • If the component has no child content, no width and height, no constraints, no settings, but the parent container provides a constraint, the container is filled with the size of the parent container.
  • If the component is configured with its method and the parent container does not provide constraints, the container will resize to just wrap the child content.
  • If the component is configured with its way and the parent container is configured with constraints, the container will try to fill the parent container and arrange the child content according to its way.
  • Unless the component has a child content, but does not set the width, height, constraints, and its method, the container will apply the constraints of the parent container to the child content, and at the same time make the size of the container wrap the child content.
  • The margin and padding properties of the container also affect the layout.

Column

The official document displays his child nodes vertically. If you want the child nodes to divide the available height equally, you need to include the child content in the Expanded. At the same time, Column does not support scrolling. If you need to support scrolling, please use ListView. If there is only one sub-content, try to use Align or Center to control the display position of the sub-content.

Common attributes:

  • children([]): multiple child content
  • crossAxisAlignment(CrossAxisAlignment): cross alignment method
  • mainAxisAlignment(MainAxisAlignment): The way the main axis is aligned
  • mainAxisSize(MainAxisSize): main axis size limit

Note: If the in-line controls are not enough to display all the sub-contents, a yellow square and a red warning bar will be displayed on the right side of the Row container.

Row’s layout algorithm:

  1. Assign a Null or 0 flex parameter to each sub-content (non-Expended), which means that there is no height limit and the passed width limit. When crossAxisAlignment is set to stretch, the maximum width passed in is used as the width limit.
  2. According to the size set by the flex parameter, divide the remaining vertical space to the sub-content with flex
  3. Add all the vertical (height) constraints consistent with step 1 to the remaining sub-content. If the Flexible.fit property of the child content is FlexFit.tight, strict constraints are applied to fill the size allocated by the Column. If the Flexible.fit of the sub-content is FlexFit.loose, loose restrictions are applied and it is not mandatory to fill the size allocated by the Column.
  4. The width of the column is the maximum height of the child content.
  5. The height of the Column is specified by the mainAxisSize property. If mainAxisSize is MainAxisSize.Max, the width of Row is the maximum width of its parent; if mainAxisSize is MainAxisSize.Min, the width of Row is the sum of the width of its child content (not exceeding the width limit of Row’s parent)
  6. It is the mainAxisAlignment and crossAxisAlignment properties that determine the position of the child content.

Row

The official document displays its child nodes horizontally. If you want the child nodes to divide the available width equally, you need to include the child content in Expanded. At the same time, Row does not support scrolling. If you need to support scrolling, please use ListView. If there is only one sub-content, try to use the Align or Center component to control the display position of the sub-content.

Common attributes:

  • children([]): multiple child content
  • crossAxisAlignment(CrossAxisAlignment): cross alignment method
  • mainAxisAlignment(MainAxisAlignment): The way the main axis is aligned
  • mainAxisSize(MainAxisSize): main axis size limit

Note: If the in-line controls are not enough to display all the sub-contents, a yellow square and a red warning bar will be displayed on the right side of the Row container.

Row’s layout algorithm:

  1. Assign a Null or 0 flex parameter to each sub-content (non-Expended), which means that there is no width limit and the incoming height limit. When crossAxisAlignment is set to stretch, the maximum height passed in is used as the height limit.
  2. According to the size set by the flex parameter, split the remaining horizontal controls to the sub-content with flex set
  3. Add all the vertical (height) constraints consistent with step 1 to the remaining sub-content. If the Flexible.fit property of the child content is FlexFit.tight, strict constraints are applied to fill the size allocated by Row. If the Flexible.fit of the sub-content is FlexFit.loose, loose restrictions are applied and it is not mandatory to fill the size allocated by Row.
  4. The height of Row is the maximum height of the child content.
  5. The width of Row is specified by the mainAxisSize property. If mainAxisSize is MainAxisSize.Max, the width of Row is the maximum width of its parent; if mainAxisSize is MainAxisSize.Min, the width of Row is the sum of the width of its child content (not exceeding the width limit of Row’s parent)
  6. It is the mainAxisAlignment and crossAxisAlignment properties that determine the position of the child content.

Stack

Stack is a component that allows sub-content to be positioned relative to it. If you want to stack several components quickly, Stack is the most suitable. The sub-content of Stack is either positioned or non-positioned. The positioned sub-content is wrapped in the Positioned component, and at least one attribute is configured. The size of the Stack will wrap all non-positioned sub-content, and the non-positioned sub-content will be positioned according to the alignment property (default is top-left). The positioned sub-content will be positioned relative to the Stack based on top, left, bottom, and right. Stack will be rendered in stack order according to the order of children. If you want to change the order of children rendering, you can try to rearrange the order of children, and it is recommended to define a non-empty key for each child content. When a non-empty key is defined, flutter will move the corresponding child content to a new position when rearranging the order of the children, instead of recreating the child content in the new position. If you want to lay out multiple child content with a special template, or create a custom layout management, you may use CustomMultiChildLayout instead. In particular, when using Stack, you cannot locate the sub-content relative to the size of the sub-content or the number of Stack’s own children.

Common attributes:

  • children(List): child content array
  • alignment(AlignmentGeometry): alignment method
  • fit(StackFit): The size limit of non-positioned sub-content.
  • OverFlow (OverFlow): Display method of sub-content that exceeds the size of Stack
  • textDirection(TextDirection): Text rectangle

Stack layout algorithm:

GestureDetector

InkWell

It is a rectangular area used for touch operation of the corresponding Material Design. When the user clicks on the area of ​​InkWell, it will automatically render a MaterialDesign water ripple effect. The water ripple will not exceed the range of InkWell. If you don’t want to cut the water ripple effect, you can use InkResponse. The parent content of InkWell must have a Material component. The water ripple animation will actually be rendered in InkWell’s nearest Material parent content. (This is in line with the concept of Material Design). When using this component, you can call debugCheckHasMaterial(context) at the beginning of the Build function to check whether it is valid.

Common attributes:

  • borderRadius(BorderRadius): Water ripple border rounded corners
  • child(Widget): child content
  • radius(double): water ripple radiation size
  • splashColor(Color): water ripple color
  • containedInkWell(bool): Whether the water ripple can exceed the container
  • enableFeedback(bool): Whether there is a sound or vibration prompt when the interaction is detected
  • onTap(Function)
  • onHover(Function)
  • hoverColor(Color): the color of the Hover state

Icon

The official document is a graphical icon component, drawn according to the font icon information defined by IconData. You can use the Material style Icons built into flutter. Icon is not an interactive component. If you want to build an interactive Icon, it is recommended to use IconButton. Note: The rendering of non-square icons may be wrong.

Common attributes:

  • color(Color): icon color
  • icon(IconData): icon
  • semanticLabel(String): The description of the icon. Effective in obstacle mode.
  • size(double): size
  • textDirection (TextDirection): 方向

TextField

Official documentation This widget allows users to enter text. When the user modifies the content, the onChanged function will be called back. When the user indicates that the input is complete, the onSubmitted callback function will be called back. Most of the time onSubmitted is enough to handle the response to user input. When the user completes the input, the onEditingComplete callback function will also be called. Unlike onSubmitted, it will have a default behavior to update the text controller and terminate the keyboard focus.

If you want to control the content displayed in the TextField, you can use the controller attribute to specify a controller. The controller can not only display the content of the TextField, but also control the selection or style of the content. If you need to read the input value, you can also get it through controller.text. When the controller is no longer needed, dispose must be called.

By default in Material, the TextField will have a bottom border, which can be changed through the decoration property. If you want to inherit in the FormField component, use TextFormField first

Common attributes:

  • controller(TextEditingController):指定的controller
  • cursorColor(Color): cursor color
  • cursorRadius(Radius): the rounded corners of the cursor
  • cursorWidth(double): cursor width
  • decoration(InputDecoration): style formulation
  • enable(bool): enable/disable
  • expands(bool): Whether to fill the parent content highly
  • keyboardType(TextInputType): keyboard type
  • obscureText(bool): Whether to hide the input content
  • onChanged(Function): content input callback
  • onSubmitted(Function): content change callback
  • onTap(Function): click callback
  • readOnly(bool): read only
  • style(TextStyle): the style of the input content
  • textAlign (TextAlign): content alignment
  • textAlignVertical(TextAlignVertical): The way the content is aligned vertically
  • toolbarOptions(ToolbarOptions): custom toolbar

Text

The official document displays a single style of text, and the displayed text can be broken. When the style attribute is not defined, Text will use the DefaultTextStyle of the nearest parent content. If you set the TextStyle.inherit of style to true, the given style will be merged with the DefaultTextStyle of the nearest parent content.

Using the Text.rich constructor, Text can use TextSpan to display a paragraph of text with different formats. The RichText widget can also achieve the same effect.

If you want to interact through Text, you can wrap it in the GestureDetector component. However, in the application of MaterialDesign, it is recommended to use FlatButton parts instead. If FlatButton is not applicable, InkWell can be used instead of GestureDetector.

If you want to perform interactive operations on a certain part of a text, use the RichText component and assign TapGestureRecognized to the recognized property of the TextSpan that needs to be interacted.

Common attributes:

  • data(String): the displayed text
  • locale(Locale): localized configuration
  • maxLines(int): Maximum number of displayed lines
  • overflow(TextOverflow): the display method of text overflow
  • style(TextStyle): text style
  • textAlign (TextAlign): text alignment
  • textDirection(TextDirection): text display mode

Divider

SizedBox

The official document is a container of a specified size.

If the sub-content is defined, the sub-content will be forced to have the width and height of the SizedBox. If the SizedBox does not define the width and height, it will wrap the child content, but if the size of the child content depends on the size of the parent content, the size of the SizedBox must be provided. If there is no child content, SizedBox will try to match the size limit of the parent content.

If there is no width and height for SizedBox and no sub-content, the default width and height will be 0.

The constructor of SizedBox.expand can construct a SizedBox whose width and height match the parent content. The effect is equivalent to setting Width and Height to double.infinity.

Common attributes:

  • height(double)
  • width(double)
  • child(Widget)

Navigator

SingleChildScrollView

Hero

FloatingActionButton

RaisedButton

Official document

AspectRatio

PageController

PageView

Download Details:

Author: McPorkChop

Source Code: https://github.com/McPorkChop/AlfredFirstFlutterMaterialApp

#flutter #dart #mobile-apps

What is GEEK

Buddha Community

Flutter app demo, using Material theme

Google's Flutter 1.20 stable announced with new features - Navoki

Flutter Google cross-platform UI framework has released a new version 1.20 stable.

Flutter is Google’s UI framework to make apps for Android, iOS, Web, Windows, Mac, Linux, and Fuchsia OS. Since the last 2 years, the flutter Framework has already achieved popularity among mobile developers to develop Android and iOS apps. In the last few releases, Flutter also added the support of making web applications and desktop applications.

Last month they introduced the support of the Linux desktop app that can be distributed through Canonical Snap Store(Snapcraft), this enables the developers to publish there Linux desktop app for their users and publish on Snap Store.  If you want to learn how to Publish Flutter Desktop app in Snap Store that here is the tutorial.

Flutter 1.20 Framework is built on Google’s made Dart programming language that is a cross-platform language providing native performance, new UI widgets, and other more features for the developer usage.

Here are the few key points of this release:

Performance improvements for Flutter and Dart

In this release, they have got multiple performance improvements in the Dart language itself. A new improvement is to reduce the app size in the release versions of the app. Another performance improvement is to reduce junk in the display of app animation by using the warm-up phase.

sksl_warm-up

If your app is junk information during the first run then the Skia Shading Language shader provides for pre-compilation as part of your app’s build. This can speed it up by more than 2x.

Added a better support of mouse cursors for web and desktop flutter app,. Now many widgets will show cursor on top of them or you can specify the type of supported cursor you want.

Autofill for mobile text fields

Autofill was already supported in native applications now its been added to the Flutter SDK. Now prefilled information stored by your OS can be used for autofill in the application. This feature will be available soon on the flutter web.

flutter_autofill

A new widget for interaction

InteractiveViewer is a new widget design for common interactions in your app like pan, zoom drag and drop for resizing the widget. Informations on this you can check more on this API documentation where you can try this widget on the DartPad. In this release, drag-drop has more features added like you can know precisely where the drop happened and get the position.

Updated Material Slider, RangeSlider, TimePicker, and DatePicker

In this new release, there are many pre-existing widgets that were updated to match the latest material guidelines, these updates include better interaction with Slider and RangeSliderDatePicker with support for date range and time picker with the new style.

flutter_DatePicker

New pubspec.yaml format

Other than these widget updates there is some update within the project also like in pubspec.yaml file format. If you are a flutter plugin publisher then your old pubspec.yaml  is no longer supported to publish a plugin as the older format does not specify for which platform plugin you are making. All existing plugin will continue to work with flutter apps but you should make a plugin update as soon as possible.

Preview of embedded Dart DevTools in Visual Studio Code

Visual Studio code flutter extension got an update in this release. You get a preview of new features where you can analyze that Dev tools in your coding workspace. Enable this feature in your vs code by _dart.previewEmbeddedDevTools_setting. Dart DevTools menu you can choose your favorite page embed on your code workspace.

Network tracking

The updated the Dev tools comes with the network page that enables network profiling. You can track the timings and other information like status and content type of your** network calls** within your app. You can also monitor gRPC traffic.

Generate type-safe platform channels for platform interop

Pigeon is a command-line tool that will generate types of safe platform channels without adding additional dependencies. With this instead of manually matching method strings on platform channel and serializing arguments, you can invoke native class and pass nonprimitive data objects by directly calling the Dartmethod.

There is still a long list of updates in the new version of Flutter 1.2 that we cannot cover in this blog. You can get more details you can visit the official site to know more. Also, you can subscribe to the Navoki newsletter to get updates on these features and upcoming new updates and lessons. In upcoming new versions, we might see more new features and improvements.

You can get more free Flutter tutorials you can follow these courses:

#dart #developers #flutter #app developed #dart devtools in visual studio code #firebase local emulator suite in flutter #flutter autofill #flutter date picker #flutter desktop linux app build and publish on snapcraft store #flutter pigeon #flutter range slider #flutter slider #flutter time picker #flutter tutorial #flutter widget #google flutter #linux #navoki #pubspec format #setup flutter desktop on windows

Chloe  Butler

Chloe Butler

1667425440

Pdf2gerb: Perl Script Converts PDF Files to Gerber format

pdf2gerb

Perl script converts PDF files to Gerber format

Pdf2Gerb generates Gerber 274X photoplotting and Excellon drill files from PDFs of a PCB. Up to three PDFs are used: the top copper layer, the bottom copper layer (for 2-sided PCBs), and an optional silk screen layer. The PDFs can be created directly from any PDF drawing software, or a PDF print driver can be used to capture the Print output if the drawing software does not directly support output to PDF.

The general workflow is as follows:

  1. Design the PCB using your favorite CAD or drawing software.
  2. Print the top and bottom copper and top silk screen layers to a PDF file.
  3. Run Pdf2Gerb on the PDFs to create Gerber and Excellon files.
  4. Use a Gerber viewer to double-check the output against the original PCB design.
  5. Make adjustments as needed.
  6. Submit the files to a PCB manufacturer.

Please note that Pdf2Gerb does NOT perform DRC (Design Rule Checks), as these will vary according to individual PCB manufacturer conventions and capabilities. Also note that Pdf2Gerb is not perfect, so the output files must always be checked before submitting them. As of version 1.6, Pdf2Gerb supports most PCB elements, such as round and square pads, round holes, traces, SMD pads, ground planes, no-fill areas, and panelization. However, because it interprets the graphical output of a Print function, there are limitations in what it can recognize (or there may be bugs).

See docs/Pdf2Gerb.pdf for install/setup, config, usage, and other info.


pdf2gerb_cfg.pm

#Pdf2Gerb config settings:
#Put this file in same folder/directory as pdf2gerb.pl itself (global settings),
#or copy to another folder/directory with PDFs if you want PCB-specific settings.
#There is only one user of this file, so we don't need a custom package or namespace.
#NOTE: all constants defined in here will be added to main namespace.
#package pdf2gerb_cfg;

use strict; #trap undef vars (easier debug)
use warnings; #other useful info (easier debug)


##############################################################################################
#configurable settings:
#change values here instead of in main pfg2gerb.pl file

use constant WANT_COLORS => ($^O !~ m/Win/); #ANSI colors no worky on Windows? this must be set < first DebugPrint() call

#just a little warning; set realistic expectations:
#DebugPrint("${\(CYAN)}Pdf2Gerb.pl ${\(VERSION)}, $^O O/S\n${\(YELLOW)}${\(BOLD)}${\(ITALIC)}This is EXPERIMENTAL software.  \nGerber files MAY CONTAIN ERRORS.  Please CHECK them before fabrication!${\(RESET)}", 0); #if WANT_DEBUG

use constant METRIC => FALSE; #set to TRUE for metric units (only affect final numbers in output files, not internal arithmetic)
use constant APERTURE_LIMIT => 0; #34; #max #apertures to use; generate warnings if too many apertures are used (0 to not check)
use constant DRILL_FMT => '2.4'; #'2.3'; #'2.4' is the default for PCB fab; change to '2.3' for CNC

use constant WANT_DEBUG => 0; #10; #level of debug wanted; higher == more, lower == less, 0 == none
use constant GERBER_DEBUG => 0; #level of debug to include in Gerber file; DON'T USE FOR FABRICATION
use constant WANT_STREAMS => FALSE; #TRUE; #save decompressed streams to files (for debug)
use constant WANT_ALLINPUT => FALSE; #TRUE; #save entire input stream (for debug ONLY)

#DebugPrint(sprintf("${\(CYAN)}DEBUG: stdout %d, gerber %d, want streams? %d, all input? %d, O/S: $^O, Perl: $]${\(RESET)}\n", WANT_DEBUG, GERBER_DEBUG, WANT_STREAMS, WANT_ALLINPUT), 1);
#DebugPrint(sprintf("max int = %d, min int = %d\n", MAXINT, MININT), 1); 

#define standard trace and pad sizes to reduce scaling or PDF rendering errors:
#This avoids weird aperture settings and replaces them with more standardized values.
#(I'm not sure how photoplotters handle strange sizes).
#Fewer choices here gives more accurate mapping in the final Gerber files.
#units are in inches
use constant TOOL_SIZES => #add more as desired
(
#round or square pads (> 0) and drills (< 0):
    .010, -.001,  #tiny pads for SMD; dummy drill size (too small for practical use, but needed so StandardTool will use this entry)
    .031, -.014,  #used for vias
    .041, -.020,  #smallest non-filled plated hole
    .051, -.025,
    .056, -.029,  #useful for IC pins
    .070, -.033,
    .075, -.040,  #heavier leads
#    .090, -.043,  #NOTE: 600 dpi is not high enough resolution to reliably distinguish between .043" and .046", so choose 1 of the 2 here
    .100, -.046,
    .115, -.052,
    .130, -.061,
    .140, -.067,
    .150, -.079,
    .175, -.088,
    .190, -.093,
    .200, -.100,
    .220, -.110,
    .160, -.125,  #useful for mounting holes
#some additional pad sizes without holes (repeat a previous hole size if you just want the pad size):
    .090, -.040,  #want a .090 pad option, but use dummy hole size
    .065, -.040, #.065 x .065 rect pad
    .035, -.040, #.035 x .065 rect pad
#traces:
    .001,  #too thin for real traces; use only for board outlines
    .006,  #minimum real trace width; mainly used for text
    .008,  #mainly used for mid-sized text, not traces
    .010,  #minimum recommended trace width for low-current signals
    .012,
    .015,  #moderate low-voltage current
    .020,  #heavier trace for power, ground (even if a lighter one is adequate)
    .025,
    .030,  #heavy-current traces; be careful with these ones!
    .040,
    .050,
    .060,
    .080,
    .100,
    .120,
);
#Areas larger than the values below will be filled with parallel lines:
#This cuts down on the number of aperture sizes used.
#Set to 0 to always use an aperture or drill, regardless of size.
use constant { MAX_APERTURE => max((TOOL_SIZES)) + .004, MAX_DRILL => -min((TOOL_SIZES)) + .004 }; #max aperture and drill sizes (plus a little tolerance)
#DebugPrint(sprintf("using %d standard tool sizes: %s, max aper %.3f, max drill %.3f\n", scalar((TOOL_SIZES)), join(", ", (TOOL_SIZES)), MAX_APERTURE, MAX_DRILL), 1);

#NOTE: Compare the PDF to the original CAD file to check the accuracy of the PDF rendering and parsing!
#for example, the CAD software I used generated the following circles for holes:
#CAD hole size:   parsed PDF diameter:      error:
#  .014                .016                +.002
#  .020                .02267              +.00267
#  .025                .026                +.001
#  .029                .03167              +.00267
#  .033                .036                +.003
#  .040                .04267              +.00267
#This was usually ~ .002" - .003" too big compared to the hole as displayed in the CAD software.
#To compensate for PDF rendering errors (either during CAD Print function or PDF parsing logic), adjust the values below as needed.
#units are pixels; for example, a value of 2.4 at 600 dpi = .0004 inch, 2 at 600 dpi = .0033"
use constant
{
    HOLE_ADJUST => -0.004 * 600, #-2.6, #holes seemed to be slightly oversized (by .002" - .004"), so shrink them a little
    RNDPAD_ADJUST => -0.003 * 600, #-2, #-2.4, #round pads seemed to be slightly oversized, so shrink them a little
    SQRPAD_ADJUST => +0.001 * 600, #+.5, #square pads are sometimes too small by .00067, so bump them up a little
    RECTPAD_ADJUST => 0, #(pixels) rectangular pads seem to be okay? (not tested much)
    TRACE_ADJUST => 0, #(pixels) traces seemed to be okay?
    REDUCE_TOLERANCE => .001, #(inches) allow this much variation when reducing circles and rects
};

#Also, my CAD's Print function or the PDF print driver I used was a little off for circles, so define some additional adjustment values here:
#Values are added to X/Y coordinates; units are pixels; for example, a value of 1 at 600 dpi would be ~= .002 inch
use constant
{
    CIRCLE_ADJUST_MINX => 0,
    CIRCLE_ADJUST_MINY => -0.001 * 600, #-1, #circles were a little too high, so nudge them a little lower
    CIRCLE_ADJUST_MAXX => +0.001 * 600, #+1, #circles were a little too far to the left, so nudge them a little to the right
    CIRCLE_ADJUST_MAXY => 0,
    SUBST_CIRCLE_CLIPRECT => FALSE, #generate circle and substitute for clip rects (to compensate for the way some CAD software draws circles)
    WANT_CLIPRECT => TRUE, #FALSE, #AI doesn't need clip rect at all? should be on normally?
    RECT_COMPLETION => FALSE, #TRUE, #fill in 4th side of rect when 3 sides found
};

#allow .012 clearance around pads for solder mask:
#This value effectively adjusts pad sizes in the TOOL_SIZES list above (only for solder mask layers).
use constant SOLDER_MARGIN => +.012; #units are inches

#line join/cap styles:
use constant
{
    CAP_NONE => 0, #butt (none); line is exact length
    CAP_ROUND => 1, #round cap/join; line overhangs by a semi-circle at either end
    CAP_SQUARE => 2, #square cap/join; line overhangs by a half square on either end
    CAP_OVERRIDE => FALSE, #cap style overrides drawing logic
};
    
#number of elements in each shape type:
use constant
{
    RECT_SHAPELEN => 6, #x0, y0, x1, y1, count, "rect" (start, end corners)
    LINE_SHAPELEN => 6, #x0, y0, x1, y1, count, "line" (line seg)
    CURVE_SHAPELEN => 10, #xstart, ystart, x0, y0, x1, y1, xend, yend, count, "curve" (bezier 2 points)
    CIRCLE_SHAPELEN => 5, #x, y, 5, count, "circle" (center + radius)
};
#const my %SHAPELEN =
#Readonly my %SHAPELEN =>
our %SHAPELEN =
(
    rect => RECT_SHAPELEN,
    line => LINE_SHAPELEN,
    curve => CURVE_SHAPELEN,
    circle => CIRCLE_SHAPELEN,
);

#panelization:
#This will repeat the entire body the number of times indicated along the X or Y axes (files grow accordingly).
#Display elements that overhang PCB boundary can be squashed or left as-is (typically text or other silk screen markings).
#Set "overhangs" TRUE to allow overhangs, FALSE to truncate them.
#xpad and ypad allow margins to be added around outer edge of panelized PCB.
use constant PANELIZE => {'x' => 1, 'y' => 1, 'xpad' => 0, 'ypad' => 0, 'overhangs' => TRUE}; #number of times to repeat in X and Y directions

# Set this to 1 if you need TurboCAD support.
#$turboCAD = FALSE; #is this still needed as an option?

#CIRCAD pad generation uses an appropriate aperture, then moves it (stroke) "a little" - we use this to find pads and distinguish them from PCB holes. 
use constant PAD_STROKE => 0.3; #0.0005 * 600; #units are pixels
#convert very short traces to pads or holes:
use constant TRACE_MINLEN => .001; #units are inches
#use constant ALWAYS_XY => TRUE; #FALSE; #force XY even if X or Y doesn't change; NOTE: needs to be TRUE for all pads to show in FlatCAM and ViewPlot
use constant REMOVE_POLARITY => FALSE; #TRUE; #set to remove subtractive (negative) polarity; NOTE: must be FALSE for ground planes

#PDF uses "points", each point = 1/72 inch
#combined with a PDF scale factor of .12, this gives 600 dpi resolution (1/72 * .12 = 600 dpi)
use constant INCHES_PER_POINT => 1/72; #0.0138888889; #multiply point-size by this to get inches

# The precision used when computing a bezier curve. Higher numbers are more precise but slower (and generate larger files).
#$bezierPrecision = 100;
use constant BEZIER_PRECISION => 36; #100; #use const; reduced for faster rendering (mainly used for silk screen and thermal pads)

# Ground planes and silk screen or larger copper rectangles or circles are filled line-by-line using this resolution.
use constant FILL_WIDTH => .01; #fill at most 0.01 inch at a time

# The max number of characters to read into memory
use constant MAX_BYTES => 10 * M; #bumped up to 10 MB, use const

use constant DUP_DRILL1 => TRUE; #FALSE; #kludge: ViewPlot doesn't load drill files that are too small so duplicate first tool

my $runtime = time(); #Time::HiRes::gettimeofday(); #measure my execution time

print STDERR "Loaded config settings from '${\(__FILE__)}'.\n";
1; #last value must be truthful to indicate successful load


#############################################################################################
#junk/experiment:

#use Package::Constants;
#use Exporter qw(import); #https://perldoc.perl.org/Exporter.html

#my $caller = "pdf2gerb::";

#sub cfg
#{
#    my $proto = shift;
#    my $class = ref($proto) || $proto;
#    my $settings =
#    {
#        $WANT_DEBUG => 990, #10; #level of debug wanted; higher == more, lower == less, 0 == none
#    };
#    bless($settings, $class);
#    return $settings;
#}

#use constant HELLO => "hi there2"; #"main::HELLO" => "hi there";
#use constant GOODBYE => 14; #"main::GOODBYE" => 12;

#print STDERR "read cfg file\n";

#our @EXPORT_OK = Package::Constants->list(__PACKAGE__); #https://www.perlmonks.org/?node_id=1072691; NOTE: "_OK" skips short/common names

#print STDERR scalar(@EXPORT_OK) . " consts exported:\n";
#foreach(@EXPORT_OK) { print STDERR "$_\n"; }
#my $val = main::thing("xyz");
#print STDERR "caller gave me $val\n";
#foreach my $arg (@ARGV) { print STDERR "arg $arg\n"; }

Download Details:

Author: swannman
Source Code: https://github.com/swannman/pdf2gerb

License: GPL-3.0 license

#perl 

Idrish Dhankot

Idrish Dhankot

1622532470

Hire Dedicated Flutter App Developer USA| Flutter App Developers

Hire Flutter App Developers: WebClues Infotech is a Flutter App Development company. Our Flutter mobile app development team can create cross-platform apps for different industry verticals. Our Flutter developers will help you extend your business’s scope by developing enhanced functionality and a feature-rich app. To provide a rich user experience to your users, hire dedicated Flutter app developers from WebClues Infotech today!

#hire flutter app developers #hire dedicated flutter app developer usa #hire flutter app developer usa #hire dedicated flutter app developer #hire flutter developer #flutter app development company

Best Flutter App Development Company

Are you looking for the best flutter app development company? Then AppClues Infotech is the leading flutter app development company in USA offering the best service worldwide. We focused on developing hybrid mobile apps on Android & iOS and assures our end-user about exceptional and functionally-rich mobile apps.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#top flutter app development company in usa #best flutter app development service #best flutter app development company #hire flutter app developers #flutter app development company #expert flutter app development company

Best Flutter App Development Company in USA & India

AppClues Infotech is one of the best flutter app development company in USA & India. Our diverse and experienced team of developers can help you sketch the smartest and quickest solution for your mobile app development projects with the most superior technology.

For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910

#top flutter app development company in usa #best flutter app development service #best flutter app development company #hire flutter app developers #flutter app development company in usa & india #custom flutter app development service